Commit 130ef664fda82135436b600e5b214c231c91d91d

Authored by 王通
1 parent e63defd0

1.external接口完善

src/main/java/com/bsth/server_rs/dks/BxRestService.java
... ... @@ -61,11 +61,13 @@ public class BxRestService {
61 61 if (limitLines.contains(lineCode) || limitLines.contains("ALL")) {
62 62 Map<String, Object> lineMap = new HashMap<>();
63 63 Collection<LD_SectionRoute> sectionRoutes = ldSectionBufferData.findByLineCode(lineCode).get(String.format("%s_0", lineCode));
64   - StringBuilder sb = new StringBuilder();
65   - for (LD_SectionRoute sectionRoute : sectionRoutes) {
66   - sb.append(sectionRoute.getSection().getGsectionVector().replace("LINESTRING(", "").replace(")", "")).append(",");
  64 + StringBuilder sb = new StringBuilder("");
  65 + if (sectionRoutes != null) {
  66 + for (LD_SectionRoute sectionRoute : sectionRoutes) {
  67 + sb.append(sectionRoute.getSection().getGsectionVector().replace("LINESTRING(", "").replace(")", "")).append(",");
  68 + }
  69 + sb.deleteCharAt(sb.length() - 1);
67 70 }
68   - sb.deleteCharAt(sb.length() - 1);
69 71 lineMap.put("company", BasicDataBuffer.getBusinessByCode(line.getCompany()));
70 72 lineMap.put("branch", BasicDataBuffer.getBusinessByCode(String.format("%s_%s", line.getCompany(), line.getBrancheCompany())));
71 73 lineMap.put("lineName", line.getName());
... ... @@ -96,6 +98,7 @@ public class BxRestService {
96 98 return result;
97 99 }
98 100 if (limitLines.contains("ALL")) {
  101 + limitLines.clear();
99 102 for (Line line : LineBufferData.findAll()) {
100 103 limitLines.add(line.getLineCode());
101 104 }
... ... @@ -110,24 +113,30 @@ public class BxRestService {
110 113  
111 114 int count = 1;
112 115 List<Map<String, Object>> upStations = new ArrayList<>(), downStations = new ArrayList<>();
113   - for (StationRotue route : StationBufferData.findRouteByLineCode(lineCode).get(String.format("%s_0", lineCode))) {
114   - Map<String, Object> stopMap = new HashMap<>();
115   - stopMap.put("levelNo", count);
116   - stopMap.put("levelName", route.getStationName());
117   - stopMap.put("levelLonlat", String.format("%f %f", route.getStation().getLon(), route.getStation().getLat()));
118   - stopMap.put("stationCode", route.getStationCode());
119   - upStations.add(stopMap);
120   - count++;
  116 + Collection<StationRotue> upStationRoutes = StationBufferData.findRouteByLineCode(lineCode).get(String.format("%s_0", lineCode));
  117 + if (upStationRoutes != null) {
  118 + for (StationRotue route : upStationRoutes) {
  119 + Map<String, Object> stopMap = new HashMap<>();
  120 + stopMap.put("levelNo", count);
  121 + stopMap.put("levelName", route.getStationName());
  122 + stopMap.put("levelLonlat", String.format("%f %f", route.getStation().getLon(), route.getStation().getLat()));
  123 + stopMap.put("stationCode", route.getStationCode());
  124 + upStations.add(stopMap);
  125 + count++;
  126 + }
121 127 }
122 128 count = 1;
123   - for (StationRotue route : StationBufferData.findRouteByLineCode(lineCode).get(String.format("%s_1", lineCode))) {
124   - Map<String, Object> stopMap = new HashMap<>();
125   - stopMap.put("levelNo", count);
126   - stopMap.put("levelName", route.getStationName());
127   - stopMap.put("levelLonlat", String.format("%f %f", route.getStation().getLon(), route.getStation().getLat()));
128   - stopMap.put("stationCode", route.getStationCode());
129   - downStations.add(stopMap);
130   - count++;
  129 + Collection<StationRotue> downStationRoutes = StationBufferData.findRouteByLineCode(lineCode).get(String.format("%s_1", lineCode));
  130 + if (downStationRoutes != null) {
  131 + for (StationRotue route : downStationRoutes) {
  132 + Map<String, Object> stopMap = new HashMap<>();
  133 + stopMap.put("levelNo", count);
  134 + stopMap.put("levelName", route.getStationName());
  135 + stopMap.put("levelLonlat", String.format("%f %f", route.getStation().getLon(), route.getStation().getLat()));
  136 + stopMap.put("stationCode", route.getStationCode());
  137 + downStations.add(stopMap);
  138 + count++;
  139 + }
131 140 }
132 141  
133 142 lineMap.put("upStations", upStations);
... ... @@ -250,7 +259,7 @@ public class BxRestService {
250 259 String password = ThreadLocalUtils.getPassword();
251 260 Set<String> limitLines = authorizeInterceptorIn.getLimitLines(password);
252 261 Set<String> limitDevices = authorizeInterceptorIn.getLimitDevices(password);
253   - if (limitLines == null || limitLines.isEmpty() || !limitLines.contains(line)) {
  262 + if (limitLines == null || limitLines.isEmpty()) {
254 263 return result;
255 264 }
256 265 if (limitDevices == null || limitDevices.isEmpty()) {
... ...