|
|
|
@ -66,20 +66,23 @@ public class HighGasController { |
|
|
|
|
if (StringUtils.isBlank(storeName)) { |
|
|
|
|
storeName = null; |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> storeList = highGasOilPriceService.getStoreListByOilNo(storeName,regionId, oilNoName); |
|
|
|
|
for (Map<String, Object> store : storeList) { |
|
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(store.get("latitude").toString()), Double.valueOf(store.get("longitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); |
|
|
|
|
store.put("distance", Math.round(distance/100d)/10d); |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); |
|
|
|
|
Iterator<Map<String, Object>> iterator = distance.iterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
if ((int)Math.round(Double.valueOf(iterator.next().get("distance").toString())) > distanceRecent.intValue()) { |
|
|
|
|
iterator.remove(); |
|
|
|
|
SecRegion region = commonService.getParentByRegion(regionId); |
|
|
|
|
if (region != null) { |
|
|
|
|
List<Map<String, Object>> storeList = highGasOilPriceService.getStoreListByOilNo(storeName,region.getRegionId(), oilNoName); |
|
|
|
|
for (Map<String, Object> store : storeList) { |
|
|
|
|
double distance = CoordCommonUtil.getDistance(Double.valueOf(store.get("latitude").toString()), Double.valueOf(store.get("longitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); |
|
|
|
|
store.put("distance", Math.round(distance/100d)/10d); |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); |
|
|
|
|
Iterator<Map<String, Object>> iterator = distance.iterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
if ((int)Math.round(Double.valueOf(iterator.next().get("distance").toString())) > distanceRecent.intValue()) { |
|
|
|
|
iterator.remove(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum,distance.size(),pageSize,new PageInfo<>(distance))); |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum,distance.size(),pageSize,new PageInfo<>(distance))); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(new PageInfo<>()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighGasController -> getGasDetailByStoreKey() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|