Commit bdfb842664b61c4f9f8a70aa9764bfd937177ff0

Authored by 王通
1 parent c3a6754a

1.博协GPS访问接口

src/main/java/com/bsth/server_rs/gps/GpsRestService.java
... ... @@ -97,29 +97,23 @@ public class GpsRestService {
97 97  
98 98 @GET
99 99 @Path("/bx/all")
100   - public List<Map<String, Object>> bx() {
  100 + public List<GpsEntity> bx() {
101 101 List<Car> cars = CarBufferData.findAll();
102   - System.out.println(111);
103 102 Map<String, String> device2vehicle = new HashMap<>(cars.size());
104 103 for (Car car : cars) {
105 104 device2vehicle.put(car.getEquipmentCode(), car.getNbbm());
106 105 }
107   - List<Map<String, Object>> result = new ArrayList<>();
108   - Collection<GpsEntity> gpss = GpsRealDataBuffer.all();
109   - for (GpsEntity gps : gpss) {
  106 + List<GpsEntity> result = new ArrayList<>();
  107 + Collection<GpsEntity> gpsEntities = GpsRealDataBuffer.all();
  108 + for (GpsEntity gps : gpsEntities) {
110 109 String device = gps.getDeviceId();
111   - Map<String, Object> map = new HashMap<>();
112   - map.put("vehicleCode", device2vehicle.get(device));
113   - try {
114   - map.put("gpsDateTime", ThreadLocalDateUtil.formatDate(new Date(gps.getTimestamp())));
115   - } catch (ParseException e) {
116   - // TODO Auto-generated catch block
117   - e.printStackTrace();
118   - }
119   - map.put("gpsLongitude", gps.getLon());
120   - map.put("gpsLatitude", gps.getLat());
  110 + GpsEntity gpsEntity = new GpsEntity();
  111 + gpsEntity.setNbbm(device2vehicle.get(device));
  112 + gpsEntity.setTimestamp(gps.getTimestamp());
  113 + gpsEntity.setLon(gps.getLon());
  114 + gpsEntity.setLat(gps.getLat());
121 115  
122   - result.add(map);
  116 + result.add(gpsEntity);
123 117 }
124 118  
125 119 return result;
... ...