From c542c56572ea8936301a6bdc736e23b846c8c006 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期六, 04 一月 2025 18:01:58 +0800 Subject: [PATCH] 修改保级功能bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index 92fda6a..d1bac18 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -12,9 +12,13 @@ import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.order.vo.VerifiableShopVo; +import com.ruoyi.other.api.domain.Goods; +import com.ruoyi.other.api.domain.GoodsShop; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.ShopScore; import com.ruoyi.other.mapper.ShopMapper; +import com.ruoyi.other.service.GoodsService; +import com.ruoyi.other.service.GoodsShopService; import com.ruoyi.other.service.ShopScoreService; import com.ruoyi.other.service.ShopService; import com.ruoyi.other.util.GeodesyUtil; @@ -69,6 +73,10 @@ private UserShopClient userShopClient; @Resource private AppUserShopClient appUserShopClient; + @Resource + private GoodsService goodsService; + @Resource + private GoodsShopService goodsShopService; @@ -466,15 +474,27 @@ @ResponseBody @GetMapping("/getVerifiableShop") @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"}) - public R<List<VerifiableShopVo>> getVerifiableShop(String longitude, String latitude){ + public R<List<VerifiableShopVo>> getVerifiableShop(String longitude, String latitude, Integer goodsId){ String city = TencentMapUtil.inverseGeographicalAnalysis(longitude, latitude, false); city = city.substring(0, 4) + "00"; - List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city)); + LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city); + if(null != goodsId){ + Goods goods = goodsService.getById(goodsId); + if(1 == goods.getType() && 1 == goods.getAppointStore()){ + List<Integer> collect = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getGoodsId, goods)).stream().map(GoodsShop::getShopId).collect(Collectors.toList()); + if(collect.size() > 0){ + wrapper.in(Shop::getId, collect); + } + } + } + List<Shop> list = shopService.list(wrapper); List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>(); for (Shop shop : list) { VerifiableShopVo vo = new VerifiableShopVo(); vo.setId(shop.getId()); vo.setName(shop.getName()); + vo.setAddress(shop.getAddress()); + vo.setHomePicture(shop.getHomePicture()); Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84"); vo.setDistance(wgs84.longValue()); verifiableShopVoList.add(vo); -- Gitblit v1.7.1