'提交代码'

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

@ -60,7 +60,7 @@ public class HighTestController {
JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000);
JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); 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 jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000);
JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class);
JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList");

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

Loading…
Cancel
Save