Commit 46ef5393fceea74c7d95fb8d49bf1fef2bee8bd5
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong
Showing
15 changed files
with
182 additions
and
153 deletions
src/main/java/com/bsth/controller/LineVersionsController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | -import java.text.ParseException; | |
| 4 | -import java.text.SimpleDateFormat; | |
| 5 | -import java.util.Date; | |
| 6 | 3 | import java.util.List; |
| 7 | 4 | import java.util.Map; |
| 8 | 5 | |
| ... | ... | @@ -12,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 9 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 10 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 11 | |
| 15 | -import com.bsth.entity.Line; | |
| 16 | 12 | import com.bsth.entity.LineVersions; |
| 17 | 13 | import com.bsth.repository.LineRepository; |
| 18 | 14 | import com.bsth.service.LineVersionsService; |
| ... | ... | @@ -80,4 +76,13 @@ public class LineVersionsController extends BaseController<LineVersions, Integer |
| 80 | 76 | return service.add(map); |
| 81 | 77 | } |
| 82 | 78 | |
| 79 | + /** | |
| 80 | + * 根据线路id获取当前版本号 | |
| 81 | + * | |
| 82 | + */ | |
| 83 | + @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET) | |
| 84 | + public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) { | |
| 85 | + return service.findCurrentVersion(lineId); | |
| 86 | + } | |
| 87 | + | |
| 83 | 88 | } | ... | ... |
src/main/java/com/bsth/repository/LineVersionsRepository.java
| ... | ... | @@ -73,4 +73,10 @@ public interface LineVersionsRepository extends BaseRepository<LineVersions, Int |
| 73 | 73 | @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (?2 - "+1+")") |
| 74 | 74 | public LineVersions findBylineIdAndVersions(Integer id, Integer versions); |
| 75 | 75 | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 获取线路版本的上一个版本 | |
| 79 | + */ | |
| 80 | + @Query(value = " SELECT lv.versions FROM LineVersions lv where lv.line.id = ?1 and lv.status=1") | |
| 81 | + public Integer findCurrentVersion(Integer id); | |
| 76 | 82 | } | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -15,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional; |
| 15 | 15 | |
| 16 | 16 | import com.bsth.entity.Line; |
| 17 | 17 | import com.bsth.entity.StationRoute; |
| 18 | -import com.bsth.entity.StationRouteCache; | |
| 19 | 18 | |
| 20 | 19 | /** |
| 21 | 20 | * |
| ... | ... | @@ -285,6 +284,17 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 285 | 284 | "ORDER BY " + |
| 286 | 285 | "lineCode,directions,stationRouteCode") |
| 287 | 286 | List<Map<String, String>> findAllLineWithYgc(); |
| 287 | + | |
| 288 | + @Query("SELECT new map(" + | |
| 289 | + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | |
| 290 | + "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | |
| 291 | + "FROM " + | |
| 292 | + "StationRoute s " + | |
| 293 | + "WHERE " + | |
| 294 | + "s.destroy = 0 and s.lineCode = ?1 " + | |
| 295 | + "ORDER BY " + | |
| 296 | + "lineCode,directions,stationRouteCode") | |
| 297 | + List<Map<String, String>> findLineWithYgcByLine(String lineCode); | |
| 288 | 298 | |
| 289 | 299 | @Modifying |
| 290 | 300 | @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | ... | ... |
src/main/java/com/bsth/service/LineVersionsService.java
| ... | ... | @@ -33,6 +33,9 @@ public interface LineVersionsService extends BaseService<LineVersions, Integer> |
| 33 | 33 | List<LineVersions> lineUpdate(); |
| 34 | 34 | |
| 35 | 35 | LineVersions findLineVersionsMax(int lineId); |
| 36 | + | |
| 37 | + // 返回当前线路版本 | |
| 38 | + Integer findCurrentVersion(int lineId); | |
| 36 | 39 | |
| 37 | 40 | Map<String, Object> add(Map<String, Object> map); |
| 38 | 41 | ... | ... |
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
| ... | ... | @@ -250,5 +250,13 @@ public class LineVersionsServiceImpl extends BaseServiceImpl<LineVersions, Integ |
| 250 | 250 | } |
| 251 | 251 | return resultMap; |
| 252 | 252 | } |
| 253 | + | |
| 254 | + /** | |
| 255 | + * 获取当前线路版本号 | |
| 256 | + */ | |
| 257 | + @Override | |
| 258 | + public Integer findCurrentVersion(int lineId) { | |
| 259 | + return repository.findCurrentVersion(lineId); | |
| 260 | + } | |
| 253 | 261 | |
| 254 | 262 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSONObject; |
| 18 | 18 | import com.bsth.common.ResponseCode; |
| 19 | 19 | import com.bsth.entity.Line; |
| 20 | 20 | import com.bsth.entity.LineInformation; |
| 21 | +import com.bsth.entity.LineVersions; | |
| 21 | 22 | import com.bsth.entity.Section; |
| 22 | 23 | import com.bsth.entity.SectionRoute; |
| 23 | 24 | import com.bsth.entity.SectionRouteCache; |
| ... | ... | @@ -26,12 +27,14 @@ import com.bsth.entity.StationRoute; |
| 26 | 27 | import com.bsth.entity.StationRouteCache; |
| 27 | 28 | import com.bsth.repository.LineInformationRepository; |
| 28 | 29 | import com.bsth.repository.LineRepository; |
| 30 | +import com.bsth.repository.LineVersionsRepository; | |
| 29 | 31 | import com.bsth.repository.SectionRepository; |
| 30 | 32 | import com.bsth.repository.SectionRouteCacheRepository; |
| 31 | 33 | import com.bsth.repository.SectionRouteRepository; |
| 32 | 34 | import com.bsth.repository.StationRepository; |
| 33 | 35 | import com.bsth.repository.StationRouteCacheRepository; |
| 34 | 36 | import com.bsth.repository.StationRouteRepository; |
| 37 | +import com.bsth.service.LineVersionsService; | |
| 35 | 38 | import com.bsth.service.StationService; |
| 36 | 39 | import com.bsth.util.GetUIDAndCode; |
| 37 | 40 | import com.bsth.util.TransGPS; |
| ... | ... | @@ -83,6 +86,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 83 | 86 | @Autowired |
| 84 | 87 | private SectionRouteCacheRepository sectionRouteCacheRepository; |
| 85 | 88 | |
| 89 | + @Autowired | |
| 90 | + LineVersionsRepository lineVersionsRepository; | |
| 91 | + | |
| 86 | 92 | private GeoUtils geoUtils; |
| 87 | 93 | |
| 88 | 94 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| ... | ... | @@ -293,20 +299,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 293 | 299 | Integer stationId = Integer.parseInt(isHaveMap.get("id").toString()); |
| 294 | 300 | arg0 = repository.findOne(stationId); |
| 295 | 301 | |
| 296 | - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站) | |
| 297 | - List<Station> list = new ArrayList<>(); | |
| 298 | - list.add(arg0); | |
| 299 | - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class); | |
| 300 | - Station station = stationlist.get(0); | |
| 301 | - // 站点编码 | |
| 302 | - long stationCode = GetUIDAndCode.getStationId(); | |
| 303 | - station.setStationCod(String.valueOf(stationCode)); | |
| 304 | - station.setId((int)stationCode); | |
| 305 | - station.setCreateDate(null); | |
| 306 | - station.setUpdateDate(null); | |
| 307 | - repository.save(station); | |
| 308 | - arg0 = station; | |
| 309 | - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 302 | + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 303 | + arg0 = loopStartStation; | |
| 304 | + } else { | |
| 310 | 305 | List<Station> list = new ArrayList<>(); |
| 311 | 306 | list.add(arg0); |
| 312 | 307 | List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class); |
| ... | ... | @@ -318,12 +313,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 318 | 313 | station.setCreateDate(null); |
| 319 | 314 | station.setUpdateDate(null); |
| 320 | 315 | repository.save(station); |
| 321 | - arg0 = station; | |
| 322 | - loopStartStation = arg0; | |
| 323 | - repository.save(arg0); | |
| 324 | - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 325 | - arg0 = loopStartStation; | |
| 326 | - } | |
| 316 | + arg0 = station; | |
| 317 | + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 318 | + loopStartStation = arg0; | |
| 319 | + } | |
| 320 | + } | |
| 327 | 321 | }else { |
| 328 | 322 | // 站点编码 |
| 329 | 323 | long stationCode = GetUIDAndCode.getStationId(); |
| ... | ... | @@ -417,8 +411,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 417 | 411 | // 中途站 |
| 418 | 412 | route.setStationMark("Z"); |
| 419 | 413 | } |
| 420 | - // 版本号 | |
| 421 | - route.setVersions(versions); | |
| 414 | + // 版本号(获取线路当前版本) | |
| 415 | + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId()); | |
| 416 | + route.setVersions(version); | |
| 422 | 417 | // 站点ID |
| 423 | 418 | route.setStation(arg0); |
| 424 | 419 | // 方向 |
| ... | ... | @@ -782,68 +777,65 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 782 | 777 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 783 | 778 | // 说明 |
| 784 | 779 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 785 | - if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) { | |
| 786 | - stationId = Integer.parseInt(isHaveMap.get("id").toString()); | |
| 787 | - }else { | |
| 788 | - // 站点编码 | |
| 789 | - stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); | |
| 790 | - // 站点ID | |
| 791 | - stationId = Integer.valueOf(stationCod); | |
| 792 | - // 圆半径 | |
| 793 | - Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); | |
| 794 | - // 图形类型 | |
| 795 | - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | |
| 796 | - // 创建人 | |
| 797 | - Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); | |
| 798 | - // 修改人 | |
| 799 | - Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); | |
| 800 | - // 城建坐标经度 | |
| 801 | - Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | |
| 802 | - // 城建坐标纬度 | |
| 803 | - Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | |
| 804 | - // 道路编码 | |
| 805 | - String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 806 | - // 原坐标类型 | |
| 807 | - String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | |
| 808 | - // WGS经纬度 | |
| 809 | - Float gLonx = null; | |
| 810 | - // WGS纬度 | |
| 811 | - Float gLaty = null; | |
| 812 | - if(bJwpointsArray.length>0) { | |
| 813 | - Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | |
| 814 | - gLonx = (float)resultPoint.getLng(); | |
| 815 | - gLaty = (float)resultPoint.getLat(); | |
| 816 | - } | |
| 817 | - // 多边形原坐标点集合 | |
| 818 | - String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); | |
| 819 | - // 多边形WGS坐标点集合 | |
| 820 | - String gPloygonGrid =""; | |
| 821 | - if(!bPloygonGrid.equals("")) { | |
| 822 | - String bPloygonGridArray[] = bPloygonGrid.split(","); | |
| 823 | - int bLen_ = bPloygonGridArray.length; | |
| 824 | - for(int b = 0 ;b<bLen_;b++) { | |
| 825 | - String tempArray[]= bPloygonGridArray[b].split(" "); | |
| 826 | - Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | |
| 827 | - if(b==0) { | |
| 828 | - gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 829 | - }else { | |
| 830 | - gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 831 | - } | |
| 832 | - } | |
| 780 | + // 站点编码 | |
| 781 | + stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); | |
| 782 | + // 站点ID | |
| 783 | + stationId = Integer.valueOf(stationCod); | |
| 784 | + // 圆半径 | |
| 785 | + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); | |
| 786 | + // 图形类型 | |
| 787 | + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | |
| 788 | + // 创建人 | |
| 789 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); | |
| 790 | + // 修改人 | |
| 791 | + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); | |
| 792 | + // 城建坐标经度 | |
| 793 | + Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | |
| 794 | + // 城建坐标纬度 | |
| 795 | + Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | |
| 796 | + // 道路编码 | |
| 797 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 798 | + // 原坐标类型 | |
| 799 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | |
| 800 | + // WGS经纬度 | |
| 801 | + Float gLonx = null; | |
| 802 | + // WGS纬度 | |
| 803 | + Float gLaty = null; | |
| 804 | + if(bJwpointsArray.length>0) { | |
| 805 | + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | |
| 806 | + gLonx = (float)resultPoint.getLng(); | |
| 807 | + gLaty = (float)resultPoint.getLat(); | |
| 808 | + } | |
| 809 | + // 多边形原坐标点集合 | |
| 810 | + String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); | |
| 811 | + // 多边形WGS坐标点集合 | |
| 812 | + String gPloygonGrid =""; | |
| 813 | + if(!bPloygonGrid.equals("")) { | |
| 814 | + String bPloygonGridArray[] = bPloygonGrid.split(","); | |
| 815 | + int bLen_ = bPloygonGridArray.length; | |
| 816 | + for(int b = 0 ;b<bLen_;b++) { | |
| 817 | + String tempArray[]= bPloygonGridArray[b].split(" "); | |
| 818 | + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | |
| 819 | + if(b==0) { | |
| 820 | + gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 821 | + }else { | |
| 822 | + gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 823 | + } | |
| 833 | 824 | } |
| 834 | - if(bPloygonGrid.equals("")) | |
| 835 | - bPloygonGrid = null; | |
| 836 | - else | |
| 837 | - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 838 | - if(gPloygonGrid.equals("")) | |
| 839 | - gPloygonGrid = null; | |
| 840 | - else | |
| 841 | - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | |
| 842 | - // 保存站点 | |
| 843 | - repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints, | |
| 844 | - gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, | |
| 845 | - shapesType, versions, descriptions, createBy, updateBy,stationId); | |
| 846 | 825 | } |
| 826 | + if(bPloygonGrid.equals("")) | |
| 827 | + bPloygonGrid = null; | |
| 828 | + else | |
| 829 | + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 830 | + if(gPloygonGrid.equals("")) | |
| 831 | + gPloygonGrid = null; | |
| 832 | + else | |
| 833 | + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | |
| 834 | + // 保存站点 | |
| 835 | + repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints, | |
| 836 | + gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, | |
| 837 | + shapesType, versions, descriptions, createBy, updateBy,stationId); | |
| 838 | + | |
| 847 | 839 | Station station = repository.findOne(stationId); |
| 848 | 840 | StationRoute arg0 = new StationRoute(); |
| 849 | 841 | // 距离 |
| ... | ... | @@ -1200,8 +1192,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1200 | 1192 | sectionRoute.setLine(resultLine); |
| 1201 | 1193 | // 路段编码 |
| 1202 | 1194 | sectionRoute.setSectionCode(sectionCode); |
| 1203 | - // 版本 | |
| 1204 | - sectionRoute.setVersions(versions); | |
| 1195 | + // 版本号(获取线路当前版本) | |
| 1196 | + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId()); | |
| 1197 | + sectionRoute.setVersions(version); | |
| 1205 | 1198 | sectionRoute.setDestroy(destroy); |
| 1206 | 1199 | // 方向 |
| 1207 | 1200 | sectionRoute.setDirections(directions); |
| ... | ... | @@ -1229,8 +1222,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1229 | 1222 | String libraryPointstr = s.getbJwpoints(); |
| 1230 | 1223 | String points[] = libraryPointstr.toString().split(" "); |
| 1231 | 1224 | Point center = new Point(Double.parseDouble(points[0]), Double.parseDouble(points[1])); |
| 1232 | - // 在100m内认为是同一个站点 | |
| 1233 | - Circle circle = new Circle(center, 100); | |
| 1225 | + // 在40m内认为是同一个站点 | |
| 1226 | + Circle circle = new Circle(center, 40); | |
| 1234 | 1227 | // 匹配到了用数据库中的点替换 |
| 1235 | 1228 | if (geoUtils.isPointInCircle(point, circle)) { |
| 1236 | 1229 | map.put("name", s.getStationName().toString()); |
| ... | ... | @@ -1372,20 +1365,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1372 | 1365 | Integer stationId = Integer.parseInt(stationsArray.getJSONObject(i).get("id").toString()); |
| 1373 | 1366 | arg0 = repository.findOne(stationId); |
| 1374 | 1367 | |
| 1375 | - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站) | |
| 1376 | - List<Station> list = new ArrayList<>(); | |
| 1377 | - list.add(arg0); | |
| 1378 | - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class); | |
| 1379 | - Station station = stationlist.get(0); | |
| 1380 | - // 站点编码 | |
| 1381 | - long stationCode = GetUIDAndCode.getStationId(); | |
| 1382 | - station.setStationCod(String.valueOf(stationCode)); | |
| 1383 | - station.setId((int)stationCode); | |
| 1384 | - station.setCreateDate(null); | |
| 1385 | - station.setUpdateDate(null); | |
| 1386 | - repository.save(station); | |
| 1387 | - arg0 = station; | |
| 1388 | - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 1368 | + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 1369 | + arg0 = loopStartStation; | |
| 1370 | + } else { | |
| 1389 | 1371 | List<Station> list = new ArrayList<>(); |
| 1390 | 1372 | list.add(arg0); |
| 1391 | 1373 | List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class); |
| ... | ... | @@ -1397,12 +1379,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1397 | 1379 | station.setCreateDate(null); |
| 1398 | 1380 | station.setUpdateDate(null); |
| 1399 | 1381 | repository.save(station); |
| 1400 | - arg0 = station; | |
| 1401 | - loopStartStation = arg0; | |
| 1402 | - repository.save(arg0); | |
| 1403 | - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 1404 | - arg0 = loopStartStation; | |
| 1405 | - } | |
| 1382 | + arg0 = station; | |
| 1383 | + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站 | |
| 1384 | + loopStartStation = arg0; | |
| 1385 | + } | |
| 1386 | + } | |
| 1406 | 1387 | }else { |
| 1407 | 1388 | // 站点编码 |
| 1408 | 1389 | long stationCode = GetUIDAndCode.getStationId(); | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -200,13 +200,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 200 | 200 | |
| 201 | 201 | // 先查上行 |
| 202 | 202 | upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); |
| 203 | + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode()); | |
| 203 | 204 | int startId = 1; |
| 204 | - startId = packagStationXml(upStationsList, sBuffer, startId); | |
| 205 | + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap); | |
| 205 | 206 | // 环线不查下行 |
| 206 | 207 | if(line.getLinePlayType() != 1){ |
| 207 | 208 | // 再查下行 |
| 208 | 209 | downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); |
| 209 | - packagStationXml(downStationsList, sBuffer, startId); | |
| 210 | + packagStationXml(downStationsList, sBuffer, startId,stationNumMap); | |
| 210 | 211 | } |
| 211 | 212 | sBuffer.append("</StationList>"); |
| 212 | 213 | |
| ... | ... | @@ -223,6 +224,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 223 | 224 | sBuffer.append("</LinePointList>"); |
| 224 | 225 | sBuffer.append("</XL>"); |
| 225 | 226 | sBuffer.append("</XLs>"); |
| 227 | + // 临时添加,后面删除 | |
| 228 | + if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){ | |
| 229 | + return "0"; | |
| 230 | + } | |
| 226 | 231 | // 调用上传方法 |
| 227 | 232 | if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){ |
| 228 | 233 | result = "success"; |
| ... | ... | @@ -240,6 +245,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 240 | 245 | } |
| 241 | 246 | |
| 242 | 247 | /** |
| 248 | + * 加载运管处的站点及序号 | |
| 249 | + * 上行从1开始,下行顺序续编 | |
| 250 | + */ | |
| 251 | + private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){ | |
| 252 | + Map<String, Integer> resultMap = new HashMap<>(); | |
| 253 | + List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode); | |
| 254 | + if(ygcLines != null && ygcLines.size() > 0){ | |
| 255 | + int size = ygcLines.size(); | |
| 256 | + Map<String, String> tempMap ; | |
| 257 | + int num = 1; | |
| 258 | + String key; | |
| 259 | + for (int i = 0; i < size; i ++){ | |
| 260 | + tempMap = ygcLines.get(i); | |
| 261 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | |
| 262 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | |
| 263 | + resultMap.put(key,num++); | |
| 264 | + } | |
| 265 | + } | |
| 266 | + return resultMap; | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** | |
| 243 | 270 | * 上传线路信息(按in_use上传) |
| 244 | 271 | */ |
| 245 | 272 | @Override |
| ... | ... | @@ -431,7 +458,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 431 | 458 | // 起点站的参数 |
| 432 | 459 | otherMap.put("stationMark","B"); |
| 433 | 460 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); |
| 434 | - sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) + "</FCZDXH>"); | |
| 461 | + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) + "</FCZDXH>"); | |
| 435 | 462 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); |
| 436 | 463 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); |
| 437 | 464 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); |
| ... | ... | @@ -441,7 +468,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 441 | 468 | // 终点站的参数 |
| 442 | 469 | otherMap.put("stationMark","E"); |
| 443 | 470 | paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); |
| 444 | - sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) +"</DDZDXH>"); | |
| 471 | + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) +"</DDZDXH>"); | |
| 445 | 472 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); |
| 446 | 473 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); |
| 447 | 474 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); |
| ... | ... | @@ -768,13 +795,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 768 | 795 | // 起点站的参数 |
| 769 | 796 | otherMap.put("stationMark","B"); |
| 770 | 797 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); |
| 771 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>"); | |
| 798 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); | |
| 772 | 799 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); |
| 773 | 800 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); |
| 774 | 801 | // 起点站的参数 |
| 775 | 802 | otherMap.put("stationMark","E"); |
| 776 | 803 | paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); |
| 777 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>"); | |
| 804 | + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); | |
| 778 | 805 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) |
| 779 | 806 | .append("</JHDDSJ>"); |
| 780 | 807 | sBuffer.append("</BC>"); |
| ... | ... | @@ -883,14 +910,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 883 | 910 | // 起点站的参数 |
| 884 | 911 | otherMap.put("stationMark","B"); |
| 885 | 912 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 886 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>"); | |
| 913 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); | |
| 887 | 914 | sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 888 | 915 | sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() |
| 889 | 916 | +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); |
| 890 | 917 | // 起点站的参数 |
| 891 | 918 | otherMap.put("stationMark","E"); |
| 892 | 919 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 893 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>"); | |
| 920 | + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); | |
| 894 | 921 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 895 | 922 | sBuffer.append("</BC>"); |
| 896 | 923 | } |
| ... | ... | @@ -1214,7 +1241,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1214 | 1241 | * |
| 1215 | 1242 | * @return 站点序号累加后的ID |
| 1216 | 1243 | */ |
| 1217 | - private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){ | |
| 1244 | + private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){ | |
| 1218 | 1245 | int size = stationsList.size(); |
| 1219 | 1246 | StationRoute srRoute; |
| 1220 | 1247 | HashMap<String,String> paraMap; |
| ... | ... | @@ -1231,7 +1258,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1231 | 1258 | } |
| 1232 | 1259 | paraMap = packageYgcStationNumParam(srRoute,null); |
| 1233 | 1260 | sBuffer.append("<Station>"); |
| 1234 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</ZDXH>"); | |
| 1261 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>"); | |
| 1235 | 1262 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); |
| 1236 | 1263 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); |
| 1237 | 1264 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); |
| ... | ... | @@ -1287,7 +1314,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1287 | 1314 | * @param map |
| 1288 | 1315 | * @return 运管处站点序号 |
| 1289 | 1316 | */ |
| 1290 | - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map){ | |
| 1317 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){ | |
| 1291 | 1318 | // 线路编码 |
| 1292 | 1319 | String lineCode = map.get("lineCode"); |
| 1293 | 1320 | // 线路走向 0:上行 1:下行 |
| ... | ... | @@ -1305,9 +1332,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1305 | 1332 | }else if(stationMark.equals("Z")){ |
| 1306 | 1333 | marks= new String[]{"Z"}; |
| 1307 | 1334 | } |
| 1335 | + // 默认从缓存BasicData.stationName2YgcNumber | |
| 1336 | + Map<String, Integer> tempMap = BasicData.stationName2YgcNumber; | |
| 1337 | + // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取 | |
| 1338 | + if(stationNumMap != null){ | |
| 1339 | + tempMap = stationNumMap; | |
| 1340 | + } | |
| 1308 | 1341 | Integer number = null; |
| 1309 | 1342 | for (int i = 0 ;i < marks.length ; i ++){ |
| 1310 | - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); | |
| 1343 | + number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); | |
| 1311 | 1344 | if(number != null){ |
| 1312 | 1345 | break; |
| 1313 | 1346 | } | ... | ... |
src/main/resources/static/pages/base/line/css/bmap_base.css
| ... | ... | @@ -190,12 +190,10 @@ ul li a:hover:not(.active) { |
| 190 | 190 | .radio_label { |
| 191 | 191 | display:block; |
| 192 | 192 | color: white; |
| 193 | - float: left; | |
| 194 | 193 | cursor: pointer; |
| 195 | 194 | margin-left: 50px; |
| 196 | 195 | font-size: 20px; |
| 197 | 196 | margin-top: 5px; |
| 198 | - text-align: center; | |
| 199 | 197 | } |
| 200 | 198 | .radioclass { |
| 201 | 199 | margin-top: 6px !important; |
| ... | ... | @@ -207,7 +205,4 @@ ul li a:hover:not(.active) { |
| 207 | 205 | } |
| 208 | 206 | .on { |
| 209 | 207 | background-position: 0 0; |
| 210 | -} | |
| 211 | - | |
| 212 | - | |
| 213 | - | |
| 208 | +} | |
| 214 | 209 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/line/map.html
| ... | ... | @@ -196,12 +196,12 @@ $(function(){ |
| 196 | 196 | params.lineId=line.id; |
| 197 | 197 | params.dir = line.dir; |
| 198 | 198 | $.get('/stationroute/findCachePoint',params,function(data){ |
| 199 | - var station_radio_html = '<div id="station_radio">'; | |
| 199 | + var station_radio_html = '<div id="station_radio" >'; | |
| 200 | 200 | var cont = 1; |
| 201 | 201 | var check = 'checked="checked"'; |
| 202 | 202 | $.each(data,function(){ |
| 203 | 203 | stationRouteMap[this.stationRouteId] = this; |
| 204 | - station_radio_html += '<div class="radio"><label class="radio_label on"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>"; | |
| 204 | + station_radio_html += '<div class="radio" ><label class="radio_label on"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>"; | |
| 205 | 205 | cont++; |
| 206 | 206 | }); |
| 207 | 207 | station_radio_html += '</div>'; | ... | ... |
src/main/resources/static/pages/base/section/js/add-form-events.js
| ... | ... | @@ -22,12 +22,8 @@ $(function(){ |
| 22 | 22 | $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码. |
| 23 | 23 | $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID. |
| 24 | 24 | // 版本号赋值 |
| 25 | - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){ | |
| 26 | - $.each(lineVersions,function(){ | |
| 27 | - if (this.status == 1) { | |
| 28 | - $('#versionsInput').val(this.versions); | |
| 29 | - } | |
| 30 | - }) | |
| 25 | + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){ | |
| 26 | + $('#versionsInput').val(versions); | |
| 31 | 27 | }); |
| 32 | 28 | // 获取该线路下的路段路由. |
| 33 | 29 | PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) { | ... | ... |
src/main/resources/static/pages/base/station/js/add-form-events.js
| ... | ... | @@ -24,12 +24,8 @@ $(function(){ |
| 24 | 24 | $('#lineCodeInput').val(lineSelectValueArray[1]); |
| 25 | 25 | var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir}; |
| 26 | 26 | // 版本号赋值 |
| 27 | - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){ | |
| 28 | - $.each(lineVersions,function(){ | |
| 29 | - if (this.status == 1) { | |
| 30 | - $('#versionsInput').val(this.versions); | |
| 31 | - } | |
| 32 | - }) | |
| 27 | + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){ | |
| 28 | + $('#versionsInput').val(versions); | |
| 33 | 29 | }); |
| 34 | 30 | initSelect(params); |
| 35 | 31 | } | ... | ... |
src/main/resources/static/pages/base/stationroute/add.html
| ... | ... | @@ -237,12 +237,8 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,stao |
| 237 | 237 | // 是否撤销 |
| 238 | 238 | $('#destroySelect').val(0); |
| 239 | 239 | // 版本号 |
| 240 | - $.get('/lineVersions/findByLineId',{'lineId':Line.id},function(lineVersions){ | |
| 241 | - $.each(lineVersions,function(){ | |
| 242 | - if (this.status == 1) { | |
| 243 | - $('#versionsInput').val(this.versions); | |
| 244 | - } | |
| 245 | - }) | |
| 240 | + $.get('/lineVersions/findCurrentVersion',{'lineId':Line.id},function(versions){ | |
| 241 | + $('#versionsInput').val(versions); | |
| 246 | 242 | }); |
| 247 | 243 | |
| 248 | 244 | var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir}; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -216,7 +216,6 @@ var WorldsBMap = function () { |
| 216 | 216 | |
| 217 | 217 | // 地图画多边形 |
| 218 | 218 | pointsPolygon : function(objStation) { |
| 219 | - debugger | |
| 220 | 219 | |
| 221 | 220 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) |
| 222 | 221 | mapBValue.setZoom(15); |
| ... | ... | @@ -374,7 +373,6 @@ var WorldsBMap = function () { |
| 374 | 373 | |
| 375 | 374 | // 画圆 |
| 376 | 375 | pointsCircle : function(objStation) { |
| 377 | - debugger | |
| 378 | 376 | |
| 379 | 377 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) |
| 380 | 378 | mapBValue.setZoom(16); | ... | ... |
src/main/resources/static/pages/trafficManage/js/lineStationUpload.js
src/main/resources/static/pages/trafficManage/js/lineStationUploadRecord.js
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | |
| 32 | 32 | initLineSelect2(); |
| 33 | 33 | |
| 34 | - function initLineSelect2(compD) {debugger; | |
| 34 | + function initLineSelect2(compD) { | |
| 35 | 35 | getComp(function(rs) { |
| 36 | 36 | var params = {}; |
| 37 | 37 | if(rs.length>0) { |
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | if(len_>0) { |
| 56 | 56 | $.each(array, function(i, g){ |
| 57 | 57 | if(g.name!='' || g.name != null) { |
| 58 | - paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name}); | |
| 58 | + paramsD.push({'id':g.id ,'text':g.name}); | |
| 59 | 59 | } |
| 60 | 60 | }); |
| 61 | 61 | initPinYinSelect2($('#line'),paramsD,function(selector) { | ... | ... |