|
|
@@ -357,9 +357,9 @@ public class CommonServiceImpl implements CommonService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<Long, LocationVO> getLocation(List<Long> truckIds) {
|
|
|
+ public Map<String, LocationVO> getLocations(List<String> truckIds) {
|
|
|
List<String> clientIds = new ArrayList();
|
|
|
- for (Long truckId : truckIds) {
|
|
|
+ for (String truckId : truckIds) {
|
|
|
QueryWrapper<TruckSimCard> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("truck_id", truckId);
|
|
|
TruckSimCard truckSimCard = truckSimCardService.getOne(queryWrapper);
|
|
|
@@ -368,7 +368,7 @@ public class CommonServiceImpl implements CommonService {
|
|
|
clientIds.add(null);
|
|
|
continue;
|
|
|
}
|
|
|
- clientIds.add(truckSimCard.getClientId());
|
|
|
+ clientIds.add(truckSimCard.getSimCard());
|
|
|
}
|
|
|
log.info("getLocation clientIds:{}", JSON.toJSONString(clientIds));
|
|
|
Query query = new Query(Criteria.where("clientId").in(clientIds).and("messageId").is(512));
|
|
|
@@ -379,7 +379,6 @@ public class CommonServiceImpl implements CommonService {
|
|
|
// // 筛选条件
|
|
|
// operations.add(Aggregation.match(Criteria.where("clientId").in(clientIds).and("messageId").is(512)));
|
|
|
// operations.sort(new Sort(Sort.Direction.DESC, "dateTime"));
|
|
|
-//
|
|
|
// // 分组字段
|
|
|
// GroupOperation groupOperation = Aggregation.group("clientId").first();
|
|
|
// SortOperation sortOperation = Aggregation.sort(Sort.by(Sort.Direction.DESC, "dateTime"));
|
|
|
@@ -390,10 +389,8 @@ public class CommonServiceImpl implements CommonService {
|
|
|
// // 添加选项 (聚合查询字段和添加筛选是有区别的注意)
|
|
|
// operations.add(groupOperation);
|
|
|
// operations.add(sortOperation);
|
|
|
-//
|
|
|
// // 最终聚合查询所有信息
|
|
|
// Aggregation aggregation = Aggregation.newAggregation(operations);
|
|
|
-//
|
|
|
// // 查询结果
|
|
|
// AggregationResults<HashMap> results = mongoTemplate.aggregate(aggregation, "tms_dev", HashMap.class);
|
|
|
// //获取结果
|
|
|
@@ -414,17 +411,7 @@ public class CommonServiceImpl implements CommonService {
|
|
|
|
|
|
List<TmsMongoDoc> tmsMongoDocs =
|
|
|
mongoTemplate.aggregate(typedAggregation, TmsMongoDoc.class).getMappedResults();
|
|
|
-// if (tmsMongoDoc != null) {
|
|
|
-// location = new LocationVO();
|
|
|
-// location.setLatitude(tmsMongoDoc.getLatitude() + "");
|
|
|
-// location.setLongitude(tmsMongoDoc.getLongitude() + "");
|
|
|
-// location.setCarNumber(truckSimCard.getCarNumber());
|
|
|
-// location.setTruckId(truckSimCard.getTruckId());
|
|
|
-// location.setDate(tmsMongoDoc.getCreateTime());
|
|
|
-// }
|
|
|
-// return location;
|
|
|
- log.info("getLocation results:{}", JSON.toJSONString(tmsMongoDocs));
|
|
|
- Map<Long, LocationVO> result = new HashMap();
|
|
|
+ Map<String, LocationVO> result = new HashMap();
|
|
|
for (TmsMongoDoc doc : tmsMongoDocs) {
|
|
|
for (int i=0;i<clientIds.size();i++) {
|
|
|
if (clientIds.get(i).equals(doc.getClientId())) {
|