|
|
@@ -80,16 +80,19 @@ public class TruckMongoInfoController {
|
|
|
return new Result<>(ErrCodeEnum.INVALID_TRUCK.getCode(), "卡车无simcard信息");
|
|
|
}
|
|
|
Query query = new Query(Criteria.where("clientId").is(truckSimCard.getClientId()));
|
|
|
- query.with(new Sort(Sort.Direction.DESC, "createTime"));
|
|
|
+ query.with(new Sort(Sort.Direction.DESC, "dateTime"));
|
|
|
TmsMongoDoc tmsMongoDoc = mongoTemplate.findOne(query, TmsMongoDoc.class);
|
|
|
- // TODO mongo上报数据转换
|
|
|
+ log.info("查询位置信息 truck:{}, location:{}", truckSimCard.getCarNumber(), JSON.toJSONString(tmsMongoDoc));
|
|
|
LocationVO location = new LocationVO();
|
|
|
- // 经纬度
|
|
|
- location.setLatitude(tmsMongoDoc.getLatitude()+"");
|
|
|
- location.setLongitude(tmsMongoDoc.getLongitude()+"");
|
|
|
- location.setCarNumber(truckSimCard.getCarNumber());
|
|
|
- location.setTruckId(truckSimCard.getTruckId());
|
|
|
- location.setLocalTime("20" + tmsMongoDoc.getDateTime());
|
|
|
+ if (tmsMongoDoc != null) {
|
|
|
+ // TODO mongo上报数据转换
|
|
|
+ // 经纬度
|
|
|
+ location.setLatitude(tmsMongoDoc.getLatitude() + "");
|
|
|
+ location.setLongitude(tmsMongoDoc.getLongitude() + "");
|
|
|
+ location.setCarNumber(truckSimCard.getCarNumber());
|
|
|
+ location.setTruckId(truckSimCard.getTruckId());
|
|
|
+ location.setLocalTime("20" + tmsMongoDoc.getDateTime());
|
|
|
+ }
|
|
|
return new Result<>(location);
|
|
|
}
|
|
|
|