Commit bb4ea942a8b8bd9df4bb8a78040cf331cf9e4fcd

Authored by 游瑞烽
1 parent 2c4d6041

站点添加方式修改

src/main/java/com/bsth/controller/geo_data/GeoDataController.java
@@ -48,8 +48,9 @@ public class GeoDataController { @@ -48,8 +48,9 @@ public class GeoDataController {
48 48
49 @RequestMapping(value = "addNewStationRoute",method = RequestMethod.POST) 49 @RequestMapping(value = "addNewStationRoute",method = RequestMethod.POST)
50 public Map<String, Object> addNewStationRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown 50 public Map<String, Object> addNewStationRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown
51 - ,@RequestParam String stationName,@RequestParam Float lat,@RequestParam Float lng,@RequestParam int prevRouteId){  
52 - return geoDataService.addNewStationRoute(lineCode, upDown, versions, stationName, lat, lng, prevRouteId); 51 + ,@RequestParam String stationName,@RequestParam Float lat,@RequestParam Float lng,@RequestParam int prevRouteId,
  52 + @RequestParam String addType,@RequestParam String citeStationCode,@RequestParam Long citeStationId){
  53 + return geoDataService.addNewStationRoute(lineCode, upDown, versions, stationName, lat, lng, prevRouteId, addType, citeStationCode, citeStationId);
53 } 54 }
54 55
55 @RequestMapping(value = "addNewRoadRoute",method = RequestMethod.POST) 56 @RequestMapping(value = "addNewRoadRoute",method = RequestMethod.POST)
@@ -107,4 +108,9 @@ public class GeoDataController { @@ -107,4 +108,9 @@ public class GeoDataController {
107 public Map<String, Object> batchDestroyLsSectionRout(@RequestParam String ids,@RequestParam String lineCode,@RequestParam int upDown,@RequestParam int versions) { 108 public Map<String, Object> batchDestroyLsSectionRout(@RequestParam String ids,@RequestParam String lineCode,@RequestParam int upDown,@RequestParam int versions) {
108 return geoDataService.batchDestroyLsSectionRout(ids,lineCode,upDown,versions); 109 return geoDataService.batchDestroyLsSectionRout(ids,lineCode,upDown,versions);
109 } 110 }
  111 +
  112 + @RequestMapping(value = "matchStationList",method = RequestMethod.GET)
  113 + public Map<String, Object> matchStationList(@RequestParam Map<String, Object> map) {
  114 + return geoDataService.matchStationList(map);
  115 + }
110 } 116 }
111 \ No newline at end of file 117 \ No newline at end of file
src/main/java/com/bsth/entity/geo_data/GeoStation.java
@@ -17,8 +17,12 @@ public class GeoStation { @@ -17,8 +17,12 @@ public class GeoStation {
17 17
18 private String lineCode; 18 private String lineCode;
19 19
  20 + private String lineName;
  21 +
20 private Integer directions; 22 private Integer directions;
21 23
  24 + private String stationId;
  25 +
22 private String stationCode; 26 private String stationCode;
23 27
24 private String stationMark; 28 private String stationMark;
@@ -74,6 +78,14 @@ public class GeoStation { @@ -74,6 +78,14 @@ public class GeoStation {
74 this.lineCode = lineCode; 78 this.lineCode = lineCode;
75 } 79 }
76 80
  81 + public String getLineName() {
  82 + return lineName;
  83 + }
  84 +
  85 + public void setLineName(String lineName) {
  86 + this.lineName = lineName;
  87 + }
  88 +
77 public Integer getDirections() { 89 public Integer getDirections() {
78 return directions; 90 return directions;
79 } 91 }
@@ -82,6 +94,14 @@ public class GeoStation { @@ -82,6 +94,14 @@ public class GeoStation {
82 this.directions = directions; 94 this.directions = directions;
83 } 95 }
84 96
  97 + public String getStationId() {
  98 + return stationId;
  99 + }
  100 +
  101 + public void setStationId(String stationId) {
  102 + this.stationId = stationId;
  103 + }
  104 +
85 public String getStationCode() { 105 public String getStationCode() {
86 return stationCode; 106 return stationCode;
87 } 107 }
src/main/java/com/bsth/repository/LineRepository.java
@@ -68,4 +68,33 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; { @@ -68,4 +68,33 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
68 String shortName, String shanghaiLinecode, String eqLinecode, String startPhone, String endPhone, 68 String shortName, String shanghaiLinecode, String eqLinecode, String startPhone, String endPhone,
69 Integer carSumNumber, Integer hvacCarNumber, Integer ordCarNumber, String history, String descriptions, 69 Integer carSumNumber, Integer hvacCarNumber, Integer ordCarNumber, String history, String descriptions,
70 Integer destroy, Integer supperLine, Integer spacGrade, Integer warrantCar, String lineCode, Integer region); 70 Integer destroy, Integer supperLine, Integer spacGrade, Integer warrantCar, String lineCode, Integer region);
  71 +
  72 + /**
  73 + * 查询线路版本文件
  74 + * @param lineId
  75 + * @return
  76 + */
  77 + @Query(value = "SELECT version_count FROM bsth_c_line_file_version where line = ?1", nativeQuery = true)
  78 + Integer findfileVersions(Integer lineId);
  79 +
  80 + /**
  81 + * 添加线路文件版本
  82 + * @param lineId
  83 + * @param line_code
  84 + */
  85 + @Transactional
  86 + @Modifying
  87 + @Query(value = "INSERT INTO bsth_c_line_file_version (line,line_code,version_count) VALUES (?1,?2,2)", nativeQuery = true)
  88 + public void addFileVersions(Integer lineId, String line_code);
  89 +
  90 + /**
  91 + * 线路文件版本修改
  92 + * @param lineId
  93 + * @param version_count
  94 + */
  95 + @Transactional
  96 + @Modifying
  97 + @Query(value = "UPDATE bsth_c_line_file_version set version_count=?2 WHERE line = ?1", nativeQuery = true)
  98 + public void editFileVersions(Integer lineId, Integer version_count);
  99 +
71 } 100 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -158,22 +158,33 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -158,22 +158,33 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
158 * 158 *
159 * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} 159 * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)}
160 */ 160 */
  161 +// @Query(value = "SELECT * FROM ("+
  162 +// "SELECT b.g_lonx," +
  163 +// "b.g_laty,b.b_jwpoints," +
  164 +// "a.station_mark," +
  165 +// "a.station_route_code," +
  166 +// "b.station_code," +
  167 +// "a.distances,"+
  168 +// "b.station_name," +
  169 +// "a.directions FROM (SELECT " +
  170 +// "s.station_mark," +
  171 +// "s.station_route_code," +
  172 +// "s.directions," +
  173 +// "s.distances,"+
  174 +// "s.station FROM bsth_c_stationroute s where s.line = ?1 and s.destroy=0) a " +
  175 +// "LEFT JOIN bsth_c_station b " +
  176 +// " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true)
161 @Query(value = "SELECT * FROM ("+ 177 @Query(value = "SELECT * FROM ("+
162 - "SELECT b.g_lonx," +  
163 - "b.g_laty,b.b_jwpoints," +  
164 - "a.station_mark," +  
165 - "a.station_route_code," +  
166 - "b.station_code," +  
167 - "a.distances,"+  
168 - "b.station_name," +  
169 - "a.directions FROM (SELECT " +  
170 - "s.station_mark," +  
171 - "s.station_route_code," +  
172 - "s.directions," +  
173 - "s.distances,"+  
174 - "s.station FROM bsth_c_stationroute s where s.line = ?1 and s.destroy=0) a " +  
175 - "LEFT JOIN bsth_c_station b " +  
176 - " on a.station = b.id ORDER BY a.directions ASC ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true) 178 + "SELECT b.g_lonx," +
  179 + "b.g_laty,b.b_jwpoints," +
  180 + "a.station_mark," +
  181 + "a.station_route_code," +
  182 + "a.station_code," +
  183 + "a.distances,"+
  184 + "a.station_name," +
  185 + "a.directions FROM " +
  186 + " bsth_c_stationroute a , bsth_c_station b " +
  187 + " where a.line = ?1 and a.destroy=0 and a.station = b.id ) k ORDER BY k.directions,k.station_route_code ASC", nativeQuery=true)
177 List<Object[]> usingSingle(Integer lineId); 188 List<Object[]> usingSingle(Integer lineId);
178 189
179 /** 190 /**
src/main/java/com/bsth/service/geo_data/GeoDataService.java
@@ -21,7 +21,7 @@ public interface GeoDataService { @@ -21,7 +21,7 @@ public interface GeoDataService {
21 21
22 Map<String, Object> updateStationName(Map<String, Object> map); 22 Map<String, Object> updateStationName(Map<String, Object> map);
23 23
24 - Map<String,Object> addNewStationRoute(String lineCode, int upDown,int versions, String stationName, Float lat, Float lng, int prevRouteId); 24 + Map<String,Object> addNewStationRoute(String lineCode, int upDown,int versions, String stationName, Float lat, Float lng, int prevRouteId, String addType, String citeStationCode, Long citeStationId);
25 25
26 Map<String,Object> destroyStation(GeoStation station); 26 Map<String,Object> destroyStation(GeoStation station);
27 27
@@ -44,4 +44,6 @@ public interface GeoDataService { @@ -44,4 +44,6 @@ public interface GeoDataService {
44 Map<String,Object> batchDestroyLsStationRout(String ids, String lineCode, int upDown, int versions); 44 Map<String,Object> batchDestroyLsStationRout(String ids, String lineCode, int upDown, int versions);
45 45
46 Map<String,Object> batchDestroyLsSectionRout(String ids, String lineCode, int upDown, int versions); 46 Map<String,Object> batchDestroyLsSectionRout(String ids, String lineCode, int upDown, int versions);
  47 +
  48 + Map<String, Object> matchStationList(Map<String, Object> map);
47 } 49 }
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
@@ -10,6 +10,9 @@ import com.bsth.service.geo_data.impl.dto.CascadeSaveRoad; @@ -10,6 +10,9 @@ import com.bsth.service.geo_data.impl.dto.CascadeSaveRoad;
10 import com.bsth.service.geo_data.impl.dto.CascadeSaveStation; 10 import com.bsth.service.geo_data.impl.dto.CascadeSaveStation;
11 import com.bsth.service.geo_data.impl.dto.SaveRoadRouteDTO; 11 import com.bsth.service.geo_data.impl.dto.SaveRoadRouteDTO;
12 import com.bsth.service.geo_data.impl.dto.SaveStationRouteDTO; 12 import com.bsth.service.geo_data.impl.dto.SaveStationRouteDTO;
  13 +import com.bsth.util.Geo.Circle;
  14 +import com.bsth.util.Geo.GeoUtils;
  15 +import com.bsth.util.Geo.Point;
13 import com.bsth.util.GetUIDAndCode; 16 import com.bsth.util.GetUIDAndCode;
14 import com.bsth.util.TransGPS; 17 import com.bsth.util.TransGPS;
15 import com.google.common.base.Splitter; 18 import com.google.common.base.Splitter;
@@ -28,7 +31,13 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; @@ -28,7 +31,13 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
28 import java.sql.PreparedStatement; 31 import java.sql.PreparedStatement;
29 import java.sql.SQLException; 32 import java.sql.SQLException;
30 import java.text.SimpleDateFormat; 33 import java.text.SimpleDateFormat;
31 -import java.util.*; 34 +import java.util.ArrayList;
  35 +import java.util.Collections;
  36 +import java.util.Comparator;
  37 +import java.util.Date;
  38 +import java.util.HashMap;
  39 +import java.util.List;
  40 +import java.util.Map;
32 41
33 /** 42 /**
34 * Created by panzhao on 2017/12/8. 43 * Created by panzhao on 2017/12/8.
@@ -150,6 +159,68 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -150,6 +159,68 @@ public class GeoDataServiceImpl implements GeoDataService {
150 } 159 }
151 160
152 /** 161 /**
  162 + * @Description :TODO(根据坐标点匹配数据库中的站点)
  163 + *
  164 + * @param map: <point:坐标点; name:站点名>
  165 + *
  166 + */
  167 + @Override
  168 + public Map<String, Object> matchStationList(Map<String, Object> map) {
  169 + SaveStationRouteDTO a;
  170 + Map<String, Object> rs = new HashMap<>();
  171 +
  172 + //编程式事务
  173 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  174 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  175 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  176 + TransactionStatus status = tran.getTransaction(def);
  177 + try {
  178 + List<GeoStation> matchStationList = new ArrayList<>();
  179 + String matchType = map.get("matchType").toString();
  180 + String sql = "select t1.id,t1.station_name ,t1.line_code,t1.station as station_id,t1.station_code,t1.station_mark,t1.versions,t1.directions, " +
  181 + "t2.b_jwpoints,t2.g_lonx,t2.g_laty,t3.name as line_name from bsth_c_ls_stationroute t1, " +
  182 + "bsth_c_station t2 , bsth_c_line t3 where t1.station_code=t2.station_code and t1.station = t2.id and t1.line = t3.id";
  183 + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class));
  184 + if(matchType.equals("stationName")){
  185 + String stationName = map.get("stationName").toString();
  186 +
  187 + for (GeoStation station : list) {
  188 + if (station.getStationName().equals(stationName))
  189 + matchStationList.add(station);
  190 + }
  191 + }else if(matchType.equals("point")){
  192 +
  193 + Double gLonx = Double.valueOf(map.get("gLonx").toString());
  194 + Double gLaty = Double.valueOf(map.get("gLaty").toString());
  195 + //坐标转换
  196 + TransGPS.Location loc = TransGPS.LocationMake(gLonx, gLaty);
  197 + loc = TransGPS.bd_decrypt(loc);
  198 + loc = TransGPS.transformFromGCJToWGS(loc);
  199 + Point point = new Point(loc.getLng(), loc.getLat());
  200 + for (GeoStation station : list) {
  201 + Float matchGLonx = station.getgLonx();
  202 + Float matchGLaty = station.getgLaty();
  203 + Point center = new Point(matchGLonx, matchGLaty);
  204 + // 搜索100m以内的站点
  205 + Circle circle = new Circle(center, 100);
  206 + if (GeoUtils.isPointInCircle(point, circle)) {
  207 + matchStationList.add(station);
  208 + }
  209 + }
  210 + }
  211 +
  212 + rs.put("matchStationList", matchStationList);
  213 + rs.put("status", ResponseCode.SUCCESS);
  214 +
  215 + } catch (Exception e) {
  216 + logger.error("", e);
  217 + rs.put("status", ResponseCode.ERROR);
  218 + rs.put("msg", "服务器出现异常");
  219 + }
  220 + return rs;
  221 + }
  222 +
  223 + /**
153 * 编辑缓冲区信息 224 * 编辑缓冲区信息
154 * 225 *
155 * @param station 226 * @param station
@@ -688,7 +759,8 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -688,7 +759,8 @@ public class GeoDataServiceImpl implements GeoDataService {
688 } 759 }
689 760
690 @Override 761 @Override
691 - public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) { 762 + public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId,
  763 + String addType, String citeStationCode, Long citeStationId) {
692 Map<String, Object> rs = new HashMap<>(); 764 Map<String, Object> rs = new HashMap<>();
693 765
694 //编程式事务 766 //编程式事务
@@ -714,13 +786,16 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -714,13 +786,16 @@ public class GeoDataServiceImpl implements GeoDataService {
714 //按路由顺序排列 786 //按路由顺序排列
715 Collections.sort(routes, new StationRouteComp()); 787 Collections.sort(routes, new StationRouteComp());
716 788
717 - //转WGS  
718 - TransGPS.Location wgsLoc = TransGPS.transformFromGCJToWGS(TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(String.valueOf(lng)), Double.parseDouble(String.valueOf(lat))))); 789 + if(!addType.equals("cite")){
  790 + //转WGS
  791 + TransGPS.Location wgsLoc = TransGPS.transformFromGCJToWGS(TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(String.valueOf(lng)), Double.parseDouble(String.valueOf(lat)))));
719 792
720 - //insert 站点  
721 - long sCode = GetUIDAndCode.getStationId();  
722 - jdbcTemplate.update("insert into bsth_c_station(id, station_code, db_type, b_jwpoints, g_lonx, g_laty) " +  
723 - " values(?,?,?,?,?,?)", sCode, sCode, "b", lng + " " + lat, wgsLoc.getLng(), wgsLoc.getLat()); 793 + //insert 站点
  794 + citeStationId = GetUIDAndCode.getStationId();
  795 + citeStationCode = citeStationId.toString();
  796 + jdbcTemplate.update("insert into bsth_c_station(id, station_code, db_type, b_jwpoints, g_lonx, g_laty) " +
  797 + " values(?,?,?,?,?,?)", citeStationId, citeStationCode, "b", lng + " " + lat, wgsLoc.getLng(), wgsLoc.getLat());
  798 + }
724 799
725 800
726 SaveStationRouteDTO sr; 801 SaveStationRouteDTO sr;
@@ -749,8 +824,8 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -749,8 +824,8 @@ public class GeoDataServiceImpl implements GeoDataService {
749 nsr.setDirections(upDown); 824 nsr.setDirections(upDown);
750 nsr.setVersions(versions); 825 nsr.setVersions(versions);
751 nsr.setStationRouteCode(currentNo); 826 nsr.setStationRouteCode(currentNo);
752 - nsr.setStation(sCode);  
753 - nsr.setStationCode(sCode + ""); 827 + nsr.setStation(citeStationId);
  828 + nsr.setStationCode(citeStationCode);
754 nsr.setStationName(stationName); 829 nsr.setStationName(stationName);
755 nsr.setDistances(0d); 830 nsr.setDistances(0d);
756 nsr.setToTime(0d); 831 nsr.setToTime(0d);
@@ -775,6 +850,9 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -775,6 +850,9 @@ public class GeoDataServiceImpl implements GeoDataService {
775 if(routes.size() > 1) 850 if(routes.size() > 1)
776 routes.get(routes.size() - 1).setStationMark("E"); 851 routes.get(routes.size() - 1).setStationMark("E");
777 852
  853 + jdbcTemplate.update("update bsth_c_ls_stationroute set station_route_code=station_route_code+100" +
  854 + " where line_code =? and directions=? and destroy=0 and station_route_code >= ?",lineCode,upDown,currentNo);
  855 +
778 //insert 新路由 (ID自增) 856 //insert 新路由 (ID自增)
779 jdbcTemplate.update("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, radius, shapes_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" 857 jdbcTemplate.update("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, radius, shapes_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
780 , nsr.getLine(), nsr.getStation(), nsr.getStationName(), nsr.getStationRouteCode(), nsr.getLineCode(), nsr.getStationCode(), "Z" 858 , nsr.getLine(), nsr.getStation(), nsr.getStationName(), nsr.getStationRouteCode(), nsr.getLineCode(), nsr.getStationCode(), "Z"
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -694,9 +694,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -694,9 +694,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
694 try { 694 try {
695 // 获取线路ID 695 // 获取线路ID
696 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 696 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
697 - Integer fileVersions = map.get("fileVersions").equals("") ? 2 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认2  
698 /** 查询线路信息 @param:<lineId:线路ID> */ 697 /** 查询线路信息 @param:<lineId:线路ID> */
699 Line line = lineRepository.findOne(lineId); 698 Line line = lineRepository.findOne(lineId);
  699 + Integer fileVersions = lineRepository.findfileVersions(lineId);
  700 + if(fileVersions == null) {
  701 + lineRepository.addFileVersions(line.getId(), line.getLineCode());
  702 + fileVersions = 2;
  703 + } else {
  704 + fileVersions = fileVersions + 1;
  705 + lineRepository.editFileVersions(line.getId(),fileVersions);
  706 + }
  707 +// Integer fileVersions = map.get("fileVersions").equals("") ? 2 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认2
700 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ 708 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */
701 List<Object[]> objects = repository.usingSingle(lineId); 709 List<Object[]> objects = repository.usingSingle(lineId);
702 if (objects.size()>0) { 710 if (objects.size()>0) {
@@ -743,8 +751,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -743,8 +751,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
743 File targetFile = PackTarGZUtils.compress(textFile, target); 751 File targetFile = PackTarGZUtils.compress(textFile, target);
744 clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); 752 clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath);
745 // 删除文件 753 // 删除文件
746 - textFile.delete();  
747 - targetFile.delete(); 754 +// textFile.delete();
  755 +// targetFile.delete();
748 resultMap.put("status", ResponseCode.SUCCESS); 756 resultMap.put("status", ResponseCode.SUCCESS);
749 }else { 757 }else {
750 resultMap.put("status","NOTDATA"); 758 resultMap.put("status","NOTDATA");
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
@@ -217,7 +217,7 @@ a.clock_enable_version:focus{ @@ -217,7 +217,7 @@ a.clock_enable_version:focus{
217 margin-left: 0px; 217 margin-left: 0px;
218 } 218 }
219 .road_route{ 219 .road_route{
220 - padding-left: 30px; 220 + padding-left: 25px;
221 width: calc(100% - 25px); 221 width: calc(100% - 25px);
222 font-size: 14px; 222 font-size: 14px;
223 color: #242424; 223 color: #242424;
@@ -510,12 +510,13 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { @@ -510,12 +510,13 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
510 510
511 .add_station_search_point_wrap{ 511 .add_station_search_point_wrap{
512 width: 390px; 512 width: 390px;
513 - height: 126px; 513 + height: 156px;
514 position: absolute; 514 position: absolute;
515 top: 10px; 515 top: 10px;
516 left: calc(50% - 200px); 516 left: calc(50% - 200px);
517 z-index: 999; 517 z-index: 999;
518 - background: #ffface; 518 + background: #fff;
  519 + /*background: #ffface;*/
519 box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); 520 box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
520 } 521 }
521 522
@@ -579,7 +580,8 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { @@ -579,7 +580,8 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
579 top: 10px; 580 top: 10px;
580 left: calc(50% - 200px); 581 left: calc(50% - 200px);
581 z-index: 999; 582 z-index: 999;
582 - background: #ffface; 583 + background: #fff;
  584 + /*background: #ffface;*/
583 box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); 585 box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
584 } 586 }
585 587
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
@@ -163,6 +163,14 @@ @@ -163,6 +163,14 @@
163 </div> 163 </div>
164 </div> 164 </div>
165 <div class="uk-inline btns"> 165 <div class="uk-inline btns">
  166 + <button class="uk-button uk-button-primary pointSearch">坐标点查找</button>
  167 + </div>
  168 + </div>
  169 + <div class="ct_row ">
  170 + <div class="uk-inline" >
  171 + <select name="matchStationIndex" class="form-control matchStationListSelect" style="width:100%"></select>
  172 + </div>
  173 + <div class="uk-inline btns">
166 <button class="uk-button uk-button-primary submit">确定</button> 174 <button class="uk-button uk-button-primary submit">确定</button>
167 <button class="uk-button uk-button-default cancel">取消</button> 175 <button class="uk-button uk-button-default cancel">取消</button>
168 </div> 176 </div>
src/main/resources/static/pages/base/geo_data_edit/js/map.js
@@ -34,6 +34,8 @@ var gb_ct_map = function () { @@ -34,6 +34,8 @@ var gb_ct_map = function () {
34 var editCircle; 34 var editCircle;
35 var editPolygon; 35 var editPolygon;
36 var dragMarker; 36 var dragMarker;
  37 + // 站点添加和编辑时候匹配的站点MarkList
  38 + var matchStationMarkList = new Array();
37 39
38 map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); 40 map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false});
39 //中心点和缩放级别 41 //中心点和缩放级别
@@ -174,14 +176,14 @@ var gb_ct_map = function () { @@ -174,14 +176,14 @@ var gb_ct_map = function () {
174 map.openInfoWindow(win, point); 176 map.openInfoWindow(win, point);
175 } 177 }
176 178
177 - function createStationMark(statio) {  
178 - var point = new BMap.Point(statio.bd_lon, statio.bd_lat); 179 + function createStationMark(station) {
  180 + var point = new BMap.Point(station.bd_lon, station.bd_lat);
179 var marker = new BMap.Marker(point); 181 var marker = new BMap.Marker(point);
180 182
181 //根据站点名称 计算marker 宽度 183 //根据站点名称 计算marker 宽度
182 - var w = statio.stationName.length * 12 + 38 184 + var w = station.stationName.length * 12 + 38
183 , iw = w - 2; 185 , iw = w - 2;
184 - var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)}) 186 + var icon = new BMap.Icon(createStationIcon(station, w), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)})
185 marker.setIcon(icon); 187 marker.setIcon(icon);
186 marker.setShadow(null); 188 marker.setShadow(null);
187 189
@@ -208,6 +210,7 @@ var gb_ct_map = function () { @@ -208,6 +210,7 @@ var gb_ct_map = function () {
208 win.addEventListener('open', function (e) { 210 win.addEventListener('open', function (e) {
209 gb_station_route.focus(m.ct_data); 211 gb_station_route.focus(m.ct_data);
210 }); 212 });
  213 + setTop(m);
211 214
212 map.openInfoWindow(win, m.point); 215 map.openInfoWindow(win, m.point);
213 }; 216 };
@@ -489,6 +492,78 @@ var gb_ct_map = function () { @@ -489,6 +492,78 @@ var gb_ct_map = function () {
489 dragMarker.addEventListener('dragging', dragMarkerDragEvent); 492 dragMarker.addEventListener('dragging', dragMarkerDragEvent);
490 }; 493 };
491 494
  495 + /**
  496 + * 添加匹配站点
  497 + * @param i
  498 + * @param station
  499 + */
  500 + var addMatchStationMark = function(i,station) {
  501 + transCoord(station);
  502 + var point = new BMap.Point(station.bd_lon, station.bd_lat);
  503 + var marker = new BMap.Marker(point);
  504 + marker.addEventListener('click', function () {
  505 + if(this)
  506 + $(".matchStationListSelect").select2("val", this.index);
  507 + // this.openInfoWindow(new BMap.InfoWindow( {offset: new BMap.Size(0, -13)}));
  508 + // this.setColor("blue");
  509 + });
  510 +
  511 + //mouseover
  512 + marker.addEventListener('mouseover', function () {
  513 + setTop(this);
  514 + // this.setColor("blue");
  515 + });
  516 +
  517 + //mouseout
  518 + marker.addEventListener('mouseout', function () {
  519 + // this.setColor("red");
  520 + });
  521 +
  522 +
  523 + marker.index = i;
  524 + marker.stationCode = station.stationCode;
  525 + marker.stationId = station.stationId;
  526 + marker.stationName = station.stationName;
  527 + marker.lineName = station.lineName;
  528 +
  529 + var label = new BMap.Label(i,{offset:new BMap.Size(i>9?2:6,2)});
  530 + label.setStyle({border :"0", color : "white",backgroundColor:"rgba(0,0,0,0)"});
  531 + marker.setLabel(label);
  532 + marker.setTitle(i+'.'+station.stationName+'-'+station.stationCode+'-'+ station.lineName);
  533 + map.addOverlay(marker);
  534 + matchStationMarkList.push(marker);
  535 + };
  536 +
  537 + var pickMatchStationMark = function (i) {
  538 + var mark = matchStationMarkList[i];
  539 + var wi = mark.stationName.length * 12 + 38;
  540 + var opts = {
  541 + // 信息窗口宽度
  542 + width: (wi < 100 ? 100 : wi),
  543 + // 信息窗口高度
  544 + height: 20,
  545 + // 信息窗位置偏移值。
  546 + // offset: new BMap.Size(wi/2,-20),
  547 + //设置不允许信窗发送短息
  548 + enableMessage: false,
  549 + //是否开启点击地图关闭信息窗口
  550 + enableCloseOnClick: false,
  551 + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
  552 + enableAutoPan: false
  553 + };
  554 + var infoWindow_target = new BMap.InfoWindow(i+'.'+mark.stationName+'-'+mark.stationCode+'-'+ mark.lineName, opts);
  555 + mark.openInfoWindow(infoWindow_target);
  556 + map.centerAndZoom(mark.point, 16);
  557 + // 置顶覆盖物
  558 + setTop(mark);
  559 + // 把黄色添加的站点中心坐标改为mark的坐标点
  560 + pickupPoint(mark);
  561 + };
  562 +
  563 + var initMatchStationMarkList = function () {
  564 + matchStationMarkList = [0];
  565 + };
  566 +
492 var dragMarkerDragEvent = function () { 567 var dragMarkerDragEvent = function () {
493 if (editPolygon) { 568 if (editPolygon) {
494 if (!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon)) 569 if (!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon))
@@ -945,6 +1020,12 @@ var gb_ct_map = function () { @@ -945,6 +1020,12 @@ var gb_ct_map = function () {
945 focusRoad: focusRoad, 1020 focusRoad: focusRoad,
946 editStationBuffer: editStationBuffer, 1021 editStationBuffer: editStationBuffer,
947 insert_between_station_road: insert_between_station_road, 1022 insert_between_station_road: insert_between_station_road,
  1023 + getMatchStationMarkList: function () {
  1024 + return matchStationMarkList;
  1025 + },
  1026 + initMatchStationMarkList: initMatchStationMarkList,
  1027 + addMatchStationMark: addMatchStationMark,
  1028 + pickMatchStationMark: pickMatchStationMark,
948 updateStation: updateStation, 1029 updateStation: updateStation,
949 exitEditBufferStatus: exitEditBufferStatus, 1030 exitEditBufferStatus: exitEditBufferStatus,
950 changeShapeType: changeShapeType, 1031 changeShapeType: changeShapeType,
@@ -959,12 +1040,14 @@ var gb_ct_map = function () { @@ -959,12 +1040,14 @@ var gb_ct_map = function () {
959 updateDragRadius: updateDragRadius, 1040 updateDragRadius: updateDragRadius,
960 closeInfoWin: closeInfoWin, 1041 closeInfoWin: closeInfoWin,
961 showAddPointPanel: showAddPointPanel, 1042 showAddPointPanel: showAddPointPanel,
  1043 + startSearchPoint: startSearchPoint,
962 resetMapStatus: function () { 1044 resetMapStatus: function () {
963 map_status = 0; 1045 map_status = 0;
964 clearOtherOverlay(); 1046 clearOtherOverlay();
965 map.removeEventListener('dblclick', pickupPoint); 1047 map.removeEventListener('dblclick', pickupPoint);
966 map.enableDoubleClickZoom(); 1048 map.enableDoubleClickZoom();
967 }, 1049 },
  1050 + // clearOtherOverlay: clearOtherOverlay,
968 reDrawStation: reDrawStation, 1051 reDrawStation: reDrawStation,
969 reDrawRoad: reDrawRoad, 1052 reDrawRoad: reDrawRoad,
970 edit_road: start_edit_road, 1053 edit_road: start_edit_road,
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
@@ -172,7 +172,7 @@ var gb_station_route = function () { @@ -172,7 +172,7 @@ var gb_station_route = function () {
172 172
173 //上一个站点的ID 173 //上一个站点的ID
174 var _cell = $(this).parents('.station_li_transient'); 174 var _cell = $(this).parents('.station_li_transient');
175 - var $prev = prevs(_cell, 's_r_item') 175 + var $prev = prevs(_cell, 's_r_item');
176 if($prev.length > 0) 176 if($prev.length > 0)
177 addPrevId = $prev.data('id'); 177 addPrevId = $prev.data('id');
178 else 178 else
@@ -181,6 +181,45 @@ var gb_station_route = function () { @@ -181,6 +181,45 @@ var gb_station_route = function () {
181 $('.main_left_panel_m_layer').show(); 181 $('.main_left_panel_m_layer').show();
182 gb_ct_map.showAddPointPanel(name); 182 gb_ct_map.showAddPointPanel(name);
183 183
  184 + // 清楚多余覆盖物
  185 + // gb_ct_map.resetMapStatus();
  186 + var parm = {};
  187 + parm.stationName = name;
  188 + parm.matchType = 'stationName';
  189 + gb_common.$get('/_geo_data/matchStationList', parm, function (rs) {
  190 + if(rs.status == 'SUCCESS'){
  191 + var len_ = rs.matchStationList.length,paramsD = new Array();
  192 + gb_ct_map.initMatchStationMarkList();
  193 + if(len_>0) {
  194 + paramsD.push({'id':'0','text':'说明:如果没有匹配的想要的站点可以用坐标查找附近点位'});
  195 + var count = 1;
  196 + // 遍历.
  197 + $.each(rs.matchStationList, function(i, g){
  198 + // 判断.
  199 + if(g.stationName!='' && g.stationName != null) {
  200 + // 添加拼音检索下拉框格式数据数组.
  201 + paramsD.push({'id':count, 'text':count+"."+g.stationName + '-' + g.stationCode + '-' +g.lineName});
  202 + gb_ct_map.addMatchStationMark(count,g);
  203 + count++;
  204 + }
  205 + });
  206 + } else
  207 + paramsD.push({'id':'0','text':'提示:没有匹配到站点请用坐标查找附近点位'});
  208 +
  209 + $('.matchStationListSelect').empty();
  210 + // 初始化上一个路段拼音检索下拉框.
  211 + initPinYinSelect2($('.matchStationListSelect'),paramsD,function(selector) { });
  212 + $('.matchStationListSelect').on("change",function(e){
  213 + gb_ct_map.pickMatchStationMark($('.matchStationListSelect').val());
  214 + });
  215 + setTimeout(function () {
  216 + // 选中第一个匹配的站点
  217 + $(".matchStationListSelect").select2("val", 1);
  218 + },500);
  219 + } else {
  220 + }
  221 + });
  222 +
184 }); 223 });
185 //监听回车事件 224 //监听回车事件
186 $('[name=stationName]', addCell).on('keydown', function (e) { 225 $('[name=stationName]', addCell).on('keydown', function (e) {
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
@@ -81,6 +81,9 @@ var gb_data_submit = function () { @@ -81,6 +81,9 @@ var gb_data_submit = function () {
81 data.prevRouteId = gb_station_route.getAddPrevId(); 81 data.prevRouteId = gb_station_route.getAddPrevId();
82 data.lng = data.gLonx; 82 data.lng = data.gLonx;
83 data.lat = data.gLaty; 83 data.lat = data.gLaty;
  84 + data.addType = 'cite';
  85 + data.citeStationCode = gb_ct_map.getMatchStationMarkList()[data.matchStationIndex].stationCode;
  86 + data.citeStationId = gb_ct_map.getMatchStationMarkList()[data.matchStationIndex].stationId;
84 87
85 delete data.gLonx; 88 delete data.gLonx;
86 delete data.gLaty; 89 delete data.gLaty;
@@ -90,13 +93,65 @@ var gb_data_submit = function () { @@ -90,13 +93,65 @@ var gb_data_submit = function () {
90 gb_station_route.addEnd(rs.list, rs.newStationRouteCode); 93 gb_station_route.addEnd(rs.list, rs.newStationRouteCode);
91 94
92 hide_run_text(); 95 hide_run_text();
93 - UIkit.notification("修改成功!", {status: 'success'}); 96 + UIkit.notification("添加成功!", {status: 'success'});
94 }); 97 });
95 },confirmRejected); 98 },confirmRejected);
96 return false; 99 return false;
97 }); 100 });
98 101
99 /** 102 /**
  103 + * 新增站点-坐标点查找匹配站点
  104 + */
  105 + $(document).on('click', '.add_station_search_point_wrap .buffer_edit_body button.pointSearch', function (e) {
  106 + var f = $(this).parents('form');
  107 + var data = f.serializeJSON();
  108 + var stationName = data.stationName,
  109 + point = {lon:data.gLonx,lat:data.gLaty};
  110 + var parm = {};
  111 + parm.gLonx = data.gLonx;
  112 + parm.gLaty = data.gLaty;
  113 + parm.matchType = 'point';
  114 +
  115 + // 清楚地图上匹配到的站点
  116 + gb_ct_map.resetMapStatus();
  117 + // 进入新增点位 地图选点模式
  118 + gb_ct_map.startSearchPoint(point, stationName);
  119 + gb_common.$get('/_geo_data/matchStationList', parm, function (rs) {
  120 + if(rs.status == 'SUCCESS'){
  121 + var len_ = rs.matchStationList.length,paramsD = new Array();
  122 + gb_ct_map.initMatchStationMarkList();
  123 + if(len_>0) {
  124 + paramsD.push({'id':'0','text':'说明:如果没有匹配的想要的站点可以用坐标查找附近点位'});
  125 + var count = 1;
  126 + // 遍历.
  127 + $.each(rs.matchStationList, function(i, g){
  128 + // 判断.
  129 + if(g.stationName!='' && g.stationName != null) {
  130 + // 添加拼音检索下拉框格式数据数组.
  131 + paramsD.push({'id':count, 'text':count+"."+g.stationName + '-' + g.stationCode + '-' +g.lineName});
  132 + gb_ct_map.addMatchStationMark(count,g);
  133 + count++;
  134 + }
  135 + });
  136 + } else
  137 + paramsD.push({'id':'0','text':'提示:没有匹配到站点请用坐标查找附近点位'});
  138 +
  139 + $('.matchStationListSelect').empty();
  140 + // 初始化上一个路段拼音检索下拉框.
  141 + initPinYinSelect2($('.matchStationListSelect'),paramsD,function(selector) { });
  142 + $('.matchStationListSelect').on("change",function(e){
  143 + gb_ct_map.pickMatchStationMark($('.matchStationListSelect').val());
  144 + });
  145 + setTimeout(function () {
  146 + // 选中第一个匹配的站点
  147 + $(".matchStationListSelect").select2("val", 1);
  148 + },200);
  149 + } else {
  150 + }
  151 + });
  152 + });
  153 +
  154 + /**
100 * 新增路段提交 155 * 新增路段提交
101 */ 156 */
102 $(document).on('click', '.add_road_search_point_wrap .buffer_edit_body button.submit', function (e) { 157 $(document).on('click', '.add_road_search_point_wrap .buffer_edit_body button.submit', function (e) {
@@ -169,7 +224,6 @@ var gb_data_submit = function () { @@ -169,7 +224,6 @@ var gb_data_submit = function () {
169 $(document).on('click', '#add_line_versions_modal ._submit', function (e) { 224 $(document).on('click', '#add_line_versions_modal ._submit', function (e) {
170 var f = $('form', '#add_line_versions_modal'); 225 var f = $('form', '#add_line_versions_modal');
171 var data = f.serializeJSON(); 226 var data = f.serializeJSON();
172 - debugger;  
173 data.lineCode = g_line_code; 227 data.lineCode = g_line_code;
174 if(!data.startDate || !data.name){ 228 if(!data.startDate || !data.name){
175 document.getElementsByClassName('reminder_span')[0].style.visibility = 'visible'; 229 document.getElementsByClassName('reminder_span')[0].style.visibility = 'visible';
src/main/resources/static/pages/base/line/js/line-list-table.js
@@ -338,7 +338,34 @@ @@ -338,7 +338,34 @@
338 layer.msg('请选中一条线路!'); 338 layer.msg('请选中一条线路!');
339 return ; 339 return ;
340 }else { 340 }else {
341 - layer.open({ 341 + var fileVersions = $('#fileVersionsInput').val();
  342 + id = arrChk.data('id');
  343 + lineName = arrChk.val();
  344 + // 请求参数
  345 + var params = {lineId:id};//, fileVersions:fileVersions
  346 + // 关闭弹出框
  347 + // layer.close(index);
  348 + // 弹出正在加载层
  349 + var index2 = layer.load(0);
  350 + /** 生成线路行单 @pararm:<params:请求参数> */
  351 + $post('/stationroute/usingSingle',params,function(data) {
  352 + // 关闭弹出框
  353 + layer.close(index2);
  354 + if(data.status=='SUCCESS') {
  355 + // 弹出添加成功提示消息
  356 + layer.msg('生成线路【'+ lineName +'】线路文件成功!');
  357 + }else if(data.status=='ERROR'){
  358 + // 弹出添加成功提示消息
  359 + layer.msg('生成线路【'+ lineName +'】线路文件失败!');
  360 + }else if(data.status=='NOTDATA') {
  361 + // 弹出添加成功提示消息
  362 + layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!');
  363 + }else if(data.status=='NOLinePlayType') {
  364 + // 弹出添加成功提示消息
  365 + layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!');
  366 + }
  367 + });
  368 + /*layer.open({
342 title: "线路文件版本号", 369 title: "线路文件版本号",
343 // skin:'layui-layer-rim', 370 // skin:'layui-layer-rim',
344 area:['450px', 'auto'], 371 area:['450px', 'auto'],
@@ -351,39 +378,13 @@ @@ -351,39 +378,13 @@
351 +'</div>', 378 +'</div>',
352 btn:['确定','取消'], 379 btn:['确定','取消'],
353 btn1: function (index,layero) { 380 btn1: function (index,layero) {
354 - var fileVersions = $('#fileVersionsInput').val();  
355 - id = arrChk.data('id');  
356 - lineName = arrChk.val();  
357 - // 请求参数  
358 - var params = {lineId:id, fileVersions:fileVersions};  
359 - // 关闭弹出框  
360 - layer.close(index);  
361 - // 弹出正在加载层  
362 - var index2 = layer.load(0);  
363 - /** 生成线路行单 @pararm:<params:请求参数> */  
364 - $post('/stationroute/usingSingle',params,function(data) {  
365 - // 关闭弹出框  
366 - layer.close(index2);  
367 - if(data.status=='SUCCESS') {  
368 - // 弹出添加成功提示消息  
369 - layer.msg('生成线路【'+ lineName +'】线路文件成功!');  
370 - }else if(data.status=='ERROR'){  
371 - // 弹出添加成功提示消息  
372 - layer.msg('生成线路【'+ lineName +'】线路文件失败!');  
373 - }else if(data.status=='NOTDATA') {  
374 - // 弹出添加成功提示消息  
375 - layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!');  
376 - }else if(data.status=='NOLinePlayType') {  
377 - // 弹出添加成功提示消息  
378 - layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!');  
379 - }  
380 - }); 381 +
381 }, 382 },
382 btn2:function (index,layero) { 383 btn2:function (index,layero) {
383 layer.close(index); 384 layer.close(index);
384 } 385 }
385 386
386 - }); 387 + });*/
387 } 388 }
388 }); 389 });
389 /** 生成路线(路段和站点) */ 390 /** 生成路线(路段和站点) */