| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public List<Map<String, Object>> scanCodeQueryLines(Integer driverId) throws Exception { |
| | | return lineMapper.scanCodeQueryLines(driverId); |
| | | } |
| | | |
| | | /** |
| | | * 根据司机id查询当前时间之后发车的城际线路 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryFutureLinesByDriver(Integer driverId) throws Exception { |
| | | if (driverId == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return lineMapper.queryFutureLinesByDriver(driverId); |
| | | } |
| | | |
| | | /** |
| | | * 根据起始站点和终点站点查询第一条线路的目的地列表 |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryFirstLineDestinations(Integer startId, Integer endId) throws Exception { |
| | | List<Map<String, Object>> lines = queryLines(startId, endId, null); |
| | | if (lines == null || lines.size() <= 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | Map<String, Object> firstLine = lines.get(0); |
| | | if (firstLine == null || firstLine.get("id") == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | Integer lineId = Integer.valueOf(firstLine.get("id").toString()); |
| | | List<Map<String, Object>> destinations = lineMapper.queryLineDestinations(lineId); |
| | | if (destinations == null || destinations.size() <= 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | for (Map<String, Object> destination : destinations) { |
| | | Map<String, Object> fenceInfo = new HashMap<>(); |
| | | fenceInfo.put("fenceType", destination.get("fenceType")); |
| | | fenceInfo.put("coordinate", destination.get("coordinate")); |
| | | fenceInfo.put("defaultPointLon", destination.get("defaultPointLon")); |
| | | fenceInfo.put("defaultPointLat", destination.get("defaultPointLat")); |
| | | destination.put("fenceInfo", fenceInfo); |
| | | } |
| | | return destinations; |
| | | } |
| | | } |