| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BaseTable; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.service.ShoppingCartService; |
| | | import com.ruoyi.order.vo.*; |
| | | import com.ruoyi.other.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ruoyi.order.model.ShoppingCart; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RestController |
| | | @RequestMapping("/shopping-cart") |
| | | @Api(tags = "购物车") |
| | | public class ShoppingCartController { |
| | | public class ShoppingCartController extends BaseController { |
| | | |
| | | @Resource |
| | | private ShoppingCartService shoppingCartService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getMyShoppingCart/{type}/{shopId}") |
| | | @ApiOperation(value = "获取购物车列表", tags = {"购物车-小程序"}) |
| | | @ApiOperation(value = "获取购物车列表", tags = {"商城-购物车-小程序"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "type", value = "商品类型(1=服务商品,2=单品商品)", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "shopId", value = "核销门店id", required = true, dataType = "int") |
| | | }) |
| | | public AjaxResult<BaseTable<MyShoppingCartVo>> getMyShoppingCart(@PathVariable("type") Integer type, @PathVariable("shopId") Integer shopId){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | public TableDataInfo<MyShoppingCartVo> getMyShoppingCart(@PathVariable("type") Integer type, @PathVariable("shopId") Integer shopId){ |
| | | startPage(); |
| | | return getDataTable(shoppingCartService.getMyShoppingCart(type, shopId)); |
| | | } |
| | | |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "添加购物车", tags = {"商城-购物车-小程序"}) |
| | | public R<Void> addGoods(@RequestBody ShoppingCart shoppingCart) { |
| | | shoppingCartService.addGoods(shoppingCart); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/setGoodsNumber") |
| | | @ApiOperation(value = "修改购物车数量", tags = {"购物车-小程序"}) |
| | | public AjaxResult setGoodsNumber(@RequestBody SetGoodsNumber setGoodsNumber){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | @ApiOperation(value = "修改购物车数量", tags = {"商城-购物车-小程序"}) |
| | | public R setGoodsNumber(@RequestBody SetGoodsNumber setGoodsNumber){ |
| | | return shoppingCartService.setGoodsNumber(setGoodsNumber); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delShoppingCart") |
| | | @ApiOperation(value = "删除购物车", tags = {"商城-购物车-小程序"}) |
| | | public R delShoppingCart(Long id){ |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | ShoppingCart shoppingCart = shoppingCartService.getById(id); |
| | | if(!userid.equals(shoppingCart.getAppUserId())){ |
| | | return R.fail("权限不足,不允许此操作"); |
| | | } |
| | | shoppingCartService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/confirmOrder") |
| | | @ApiOperation(value = "确定购物车订单", tags = {"购物车-小程序"}) |
| | | public AjaxResult<ConfirmOrderVo> confirmOrder(@RequestBody ConfirmOrder confirmOrder){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | @ApiOperation(value = "确定购物车订单", tags = {"商城-购物车-小程序"}) |
| | | public R<ConfirmOrderVo> confirmOrder(@RequestBody ConfirmOrder confirmOrder){ |
| | | ConfirmOrderVo confirmOrderVo = shoppingCartService.confirmOrder(confirmOrder); |
| | | return R.ok(confirmOrderVo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/shoppingCartPayment") |
| | | @ApiOperation(value = "购物车订单支付", tags = {"购物车-小程序"}) |
| | | public AjaxResult shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | @ApiOperation(value = "购物车订单支付", tags = {"商城-购物车-小程序"}) |
| | | public R<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | return shoppingCartService.shoppingCartPayment(shoppingCartPayment); |
| | | } |
| | | |
| | | |