| | |
| | | @GetMapping("/shopDetail") |
| | | @ApiOperation(value = "门店详情", tags = {"小程序-首页"}) |
| | | public R<ShopDetailVO> shopDetail(@ApiParam("门店id") @RequestParam Integer shopId, |
| | | @ApiParam("经度") @RequestParam BigDecimal longitude, |
| | | @ApiParam("纬度") @RequestParam BigDecimal latitude) { |
| | | @ApiParam("经度") @RequestParam(required = false) BigDecimal longitude, |
| | | @ApiParam("纬度") @RequestParam(required = false) BigDecimal latitude) { |
| | | return R.ok(shopService.getShopDetail(shopId, longitude, latitude)); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @GetMapping("/getSysUserShop") |
| | | @ApiOperation(value = "获取可切换的门店列表", tags = {"门店后台-首页"}) |
| | | public R<List<VerifiableShopVo>> getSysUserShop(@ApiParam("经度") @RequestParam BigDecimal longitude, |
| | | @ApiParam("纬度") @RequestParam BigDecimal latitude){ |
| | | public R<List<VerifiableShopVo>> getSysUserShop(@ApiParam("经度") @RequestParam(required = false) BigDecimal longitude, |
| | | @ApiParam("纬度") @RequestParam(required = false) BigDecimal latitude){ |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(userid); |
| | | List<UserShop> data = userShopClient.getUserShop(userShop).getData(); |
| | | if (null == data || data.isEmpty()) { |
| | | return R.ok(); |
| | | } |
| | | List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>() |
| | | .in(!CollectionUtils.isEmpty(collect),Shop::getId, collect) |
| | | .eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | if (shops == null || shops.isEmpty()) { |
| | | return R.ok(); |
| | | } |
| | | List<VerifiableShopVo> list = new ArrayList<>(); |
| | | for (Shop shop : shops) { |
| | | VerifiableShopVo vo = new VerifiableShopVo(); |
| | |
| | | */ |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "发布商品", tags = {"门店后台-商品管理"}) |
| | | public R<Void> addGoods(@RequestBody AddGoodsDTO addGoodsDTO) { |
| | | shopService.addGoodsByShop(addGoodsDTO); |
| | | return R.ok(); |
| | | public R<Integer> addGoods(@RequestBody AddGoodsDTO addGoodsDTO) { |
| | | return R.ok( shopService.addGoodsByShop(addGoodsDTO)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | goodsService.update(new UpdateWrapper<Goods>() |
| | | .setSql("status = CASE status WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE status END") |
| | | .set("update_time", LocalDateTime.now()) |
| | | .eq("id", goodsId)); |
| | | return R.ok(); |
| | | } |
| | |
| | | * 删除商品 |
| | | */ |
| | | @DeleteMapping("/del/{goodsId}") |
| | | @ApiOperation(value = "发布商品", tags = {"门店后台-商品管理"}) |
| | | public R<Void> addGoods(@PathVariable Integer goodsId) { |
| | | Goods goods = goodsService.getById(goodsId); |
| | | @ApiOperation(value = "删除商品", tags = {"门店后台-商品管理"}) |
| | | public R<Void> delGoods(@PathVariable Integer goodsId) { |
| | | Goods goods = goodsService.getOne(new LambdaQueryWrapper<Goods>().eq(Goods::getId, goodsId) |
| | | .eq(Goods::getStatus, 2).eq(Goods::getDelFlag,0)); |
| | | if (goods == null) { |
| | | return R.fail("商品不存在"); |
| | | } |
| | | goodsService.removeById(goodsId); |
| | | goodsService.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getId, goodsId).set(Goods::getDelFlag,1)); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |