Commit 712798dcec7c3368e686ca82c69f78d3223b1a3e
1 parent
c39137e3
1.
Showing
1 changed file
with
30 additions
and
0 deletions
src/main/java/com/bsth/server_rs/external/ExternalService.java
| @@ -269,6 +269,36 @@ public class ExternalService { | @@ -269,6 +269,36 @@ public class ExternalService { | ||
| 269 | return result; | 269 | return result; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | + @GET | ||
| 273 | + @Path("/gps/all1") | ||
| 274 | + public List<GpsEntity> findAllGps1(@Context HttpServletRequest request) { | ||
| 275 | + List<GpsEntity> result = new ArrayList<>(); | ||
| 276 | + String password = request.getParameter("password"); | ||
| 277 | + log.error("log password: {}", password); | ||
| 278 | + log.error("stdio password: " + password); | ||
| 279 | + Set<String> limitLines = authorizeInterceptorIn.getLimitLines(password); | ||
| 280 | + Set<String> limitDevices = authorizeInterceptorIn.getLimitDevices(password); | ||
| 281 | + StringBuilder sb = new StringBuilder(); | ||
| 282 | + for (String limitDevice : limitDevices) { | ||
| 283 | + sb.append(limitDevice); | ||
| 284 | + } | ||
| 285 | + if (limitLines == null || limitLines.isEmpty()) { | ||
| 286 | + return result; | ||
| 287 | + } | ||
| 288 | + for (GpsEntity gps : GpsRealDataBuffer.all()) { | ||
| 289 | + String lineCode = gps.getLineId(), deviceId = gps.getDeviceId(); | ||
| 290 | + if ((limitLines.contains(lineCode) || limitLines.contains("ALL")) && (limitDevices.contains(deviceId) || limitDevices.contains("ALL"))) { | ||
| 291 | + Car car = CarBufferData.findByDevice(deviceId); | ||
| 292 | + if (car == null) { | ||
| 293 | + continue; | ||
| 294 | + } | ||
| 295 | + result.add(gps); | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + return result; | ||
| 300 | + } | ||
| 301 | + | ||
| 272 | // @GET | 302 | // @GET |
| 273 | // @Path("/history-arrival/{line}/{st}/{et}") | 303 | // @Path("/history-arrival/{line}/{st}/{et}") |
| 274 | // public List<HistoryArrivalEntity> historyArrival(@PathParam("line") String line, @PathParam("st") String st, @PathParam("et") String et, @Context HttpServletRequest request) { | 304 | // public List<HistoryArrivalEntity> historyArrival(@PathParam("line") String line, @PathParam("st") String st, @PathParam("et") String et, @Context HttpServletRequest request) { |