| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopGiveawayTemporary; |
| | | import com.ruoyi.other.api.domain.ShopPointCopy; |
| | | import com.ruoyi.other.api.domain.ShopScore; |
| | | import com.ruoyi.other.mapper.ShopGiveawayTemporaryMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.mapper.ShopPointCopyMapper; |
| | | import com.ruoyi.other.service.ShopScoreService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private ShopGiveawayTemporaryMapper shopGiveawayTemporaryMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | Page<Shop> page = new Page<>(); |
| | | page.setCurrent(PageNum); |
| | | page.setSize(pageSize); |
| | | return shopMapper.selectShopList(page, shop); |
| | | IPage<Shop> shopIPage = shopMapper.selectShopList(page, shop); |
| | | for (Shop record : shopIPage.getRecords()) { |
| | | List<ShopGiveawayTemporary> shopPointCopies = shopGiveawayTemporaryMapper.selectList(new LambdaQueryWrapper<ShopGiveawayTemporary>().eq(ShopGiveawayTemporary::getShopId, record.getId())); |
| | | int shopAllPoint = shopPointCopies.stream().mapToInt(ShopGiveawayTemporary::getShopAllPoint).sum(); |
| | | record.setShopAllPoint(record.getShopAllPoint() + shopAllPoint); |
| | | } |
| | | return shopIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | }); |
| | | return nearbyShopVOS; |
| | | return sortByDistance(nearbyShopVOS); |
| | | } |
| | | |
| | | public static List<NearbyShopVO> sortByDistance(List<NearbyShopVO> nearbyShopVOS) { |
| | | return nearbyShopVOS.stream() |
| | | .sorted(Comparator.comparingDouble(NearbyShopVO::getDistance)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |