| | |
| | | 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; |
| | |
| | | private UserShopClient userShopClient; |
| | | @Resource |
| | | private AppUserShopClient appUserShopClient; |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private GoodsShopService goodsShopService; |
| | | |
| | | |
| | | |
| | |
| | | @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); |