| | |
| | | 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; |
| | | |
| | | |
| | | |
| | |
| | | userShop.setUserId(sysUser.getUserId()); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShopClient.saveUserShop(userShop); |
| | | } |
| | | }else{ |
| | |
| | | userShop.setUserId(userId); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShopClient.saveUserShop(userShop); |
| | | } |
| | | return R.ok(); |
| | |
| | | userShop.setUserId(sysUser.getUserId()); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShopClient.saveUserShop(userShop); |
| | | } |
| | | }else{ |
| | |
| | | userShop.setUserId(userId); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShopClient.saveUserShop(userShop); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/freezingOrThawing") |
| | | @ApiOperation(value = "门店管理-冻结/解冻门店", tags = {"管理后台-门店管理"}) |
| | | public R freezingOrThawing(@RequestParam("id") Integer id, @RequestParam("status") Integer status){ |
| | | Shop shop = shopService.getById(id); |
| | | if(shop.getStatus().equals(status)){ |
| | | return R.fail("不能重复操作"); |
| | | } |
| | | shop.setStatus(status); |
| | | shopService.updateById(shop); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "门店列表", tags = {"管理后台-门店管理"}) |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getShopByUserId") |
| | | public R<List<Shop>> getShopByUserId(@RequestParam("id") Long id){ |
| | | List<Shop> list = shopService.lambdaQuery().eq(Shop::getAppUserId, id).list(); |
| | | List<Shop> list = shopService.lambdaQuery().eq(Shop::getAppUserId, id).eq(Shop::getDelFlag,0).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | @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); |
| | | if(null == city){ |
| | | city = "510100"; |
| | | } |
| | | 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.getId())) |
| | | .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); |