From 31d08ea7fc03f98a8628352c42d78e30d857dfbc Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 25 Jul 2021 17:17:02 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighGasController.java | 27 ++++++++++--------- .../cweb/controller/HighTestController.java | 2 +- .../impl/HighMerchantStoreServiceImpl.java | 1 + 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 91678a09..ac3eb05e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -66,20 +66,23 @@ public class HighGasController { if (StringUtils.isBlank(storeName)) { storeName = null; } - List> storeList = highGasOilPriceService.getStoreListByOilNo(storeName,regionId, oilNoName); - for (Map 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> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); - Iterator> 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> storeList = highGasOilPriceService.getStoreListByOilNo(storeName,region.getRegionId(), oilNoName); + for (Map 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> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); + Iterator> 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); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index 18e7beb9..6f07756b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -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"); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java index 3d4c73e8..b696d51a 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java @@ -150,6 +150,7 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { if (mainAccount != null) { model.setSecUser(mainAccount); } + return model; } return null; }