From 1f09f6daaf73bc83cceb4ae22b862b7b365635cf Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 03 四月 2025 19:59:17 +0800 Subject: [PATCH] 修改反馈文档bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java index 6a48227..3c1fe92 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java @@ -16,8 +16,12 @@ 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; @@ -53,6 +57,9 @@ private TokenService tokenService; @Resource private SysUserClient sysUserClient; + + @Resource + private ShopGiveawayTemporaryMapper shopGiveawayTemporaryMapper; @Override @@ -60,7 +67,13 @@ 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 @@ -134,7 +147,13 @@ } } }); - 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 -- Gitblit v1.7.1