'提交代码'

dev-discount
= 3 years ago
parent e88b3ed481
commit 31d08ea7fc
  1. 27
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  3. 1
      hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java

@ -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);

@ -60,7 +60,7 @@ public class HighTestController {
JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000);
JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class);
for (int i = 1; i < resultObjectP.getInteger("totalPageNum").intValue();i++) {
for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue();i++) {
JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000);
JSONObject resultObject = jsonObject.getObject("result", JSONObject.class);
JSONArray jsonArray = resultObject.getJSONArray("gasInfoList");

@ -150,6 +150,7 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService {
if (mainAccount != null) {
model.setSecUser(mainAccount);
}
return model;
}
return null;
}

Loading…
Cancel
Save