|
|
@@ -56,13 +56,13 @@ public class TrackLogServiceImpl extends ServiceImpl<TrackLogMapper, TrackLog> i
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public List<Double> location(TrackLog trackLog) {
|
|
|
+ public Map<String, Object> location(TrackLog trackLog) {
|
|
|
TrackKey key = CacheUtil.get(LandConst.LAND_CACHE, LandConst.TRACK_TOKEN, trackLog.getTenantId(), TrackKey.class, false);
|
|
|
if (ObjectUtil.isEmpty(key)) {
|
|
|
throw new RuntimeException("获取请求token失败");
|
|
|
}
|
|
|
|
|
|
- List<Double> data = new ArrayList<>();
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
try {
|
|
|
Map<String, String> map = new HashMap<>(5);
|
|
|
map.put("token", key.getToken());
|
|
|
@@ -79,11 +79,19 @@ public class TrackLogServiceImpl extends ServiceImpl<TrackLogMapper, TrackLog> i
|
|
|
JSONObject result = getData(res);
|
|
|
// 处理数据
|
|
|
JSONObject temp = result.getJSONObject("result");
|
|
|
+
|
|
|
BigDecimal divisor = new BigDecimal("600000");
|
|
|
BigDecimal longitude = new BigDecimal(temp.getString("lon")).divide(divisor, 6, RoundingMode.HALF_UP);
|
|
|
BigDecimal latitude = new BigDecimal(temp.getString("lat")).divide(divisor, 6, RoundingMode.HALF_UP);
|
|
|
- data.add(longitude.doubleValue());
|
|
|
- data.add(latitude.doubleValue());
|
|
|
+ List<Double> location = new ArrayList<>();
|
|
|
+ location.add(longitude.doubleValue());
|
|
|
+ location.add(latitude.doubleValue());
|
|
|
+
|
|
|
+ data.put("location", location);
|
|
|
+ data.put("address", temp.getString("adr"));
|
|
|
+ data.put("time", temp.getString("utc"));
|
|
|
+ data.put("speed", temp.getString("spd"));
|
|
|
+ data.put("mileage", temp.getString("mil"));
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("获取数据失败:" + e.getMessage());
|
|
|
}
|