| | |
| | | appUser = appUserClient.getAppUserById(userid); |
| | | } |
| | | |
| | | List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList(longitude, longitude); |
| | | List<NearbyShopVO> nearbyShopVOS = shopMapper.selectNearbyShopList(); |
| | | for (NearbyShopVO nearbyShopVO : nearbyShopVOS) { |
| | | Double wgs84 = GeodesyUtil.getDistance(nearbyShopVO.getLongitude() + "," + nearbyShopVO.getLatitude(), longitude + "," + latitude).get("WGS84"); |
| | | nearbyShopVO.setDistance(wgs84); |
| | | } |
| | | nearbyShopVOS.sort(new Comparator<NearbyShopVO>() { |
| | | @Override |
| | | public int compare(NearbyShopVO o1, NearbyShopVO o2) { |
| | | return o1.getDistance().compareTo(o2.getDistance()); |
| | | } |
| | | }); |
| | | |
| | | if(null != appUser && null != appUser.getShopId()){ |
| | | AppUser finalAppUser = appUser; |
| | | Optional<NearbyShopVO> first = nearbyShopVOS.stream().filter(s -> s.getId().equals(finalAppUser.getShopId().longValue())).findFirst(); |
| | |
| | | vo.setAddress(shop.getAddress()); |
| | | vo.setHomePicture(shop.getHomePicture()); |
| | | Double wgs84 = GeodesyUtil.getDistance(longitude.toString() + "," + latitude.toString(), shop.getLongitude() + "," + shop.getLatitude()).get("WGS84"); |
| | | vo.setDistance(wgs84.toString()); |
| | | vo.setDistance(wgs84); |
| | | nearbyShopVOS.add(0, vo); |
| | | } |
| | | } |