| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.domain.vo.AppShoppingCartVo; |
| | | import com.ruoyi.system.api.domain.dto.AppBaseBathDto; |
| | | import com.ruoyi.order.domain.dto.AppGoodsInfoGetDto; |
| | | import com.ruoyi.order.domain.dto.AppShoppingCartAddDto; |
| | |
| | | import com.ruoyi.order.service.goods.GoodsService; |
| | | import com.ruoyi.order.service.order.ShoppingCartService; |
| | | import com.ruoyi.system.api.RemoteMemberService; |
| | | import com.ruoyi.system.api.domain.dto.AppBaseDto; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | |
| | | return R.ok(appGoodsInfoVo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listShoppingCart", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取购物车列表") |
| | | public R<List<AppShoppingCartVo>> listShoppingCart() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Member member = memberService.getMember(userId).getData(); |
| | | Long shopId = member.getRelationShopId(); |
| | | List<AppShoppingCartVo> appShoppingCartVoList = shoppingCartService.listShoppingCartVo(userId, shopId); |
| | | return R.ok(appShoppingCartVoList); |
| | | } |
| | | |
| | | @RequestMapping(value = "/addShoppingCart", method = RequestMethod.POST) |
| | | @ApiOperation(value = "添加购物车") |
| | | public R addShoppingCart(@RequestBody AppShoppingCartAddDto appShoppingCartAddDto) { |
| | |
| | | @ApiOperation(value = "删除购物车") |
| | | public R changeShoppingCart(@RequestBody AppBaseBathDto appBaseBathDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if(userId!=null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | appBaseBathDto.setUserId(userId); |
| | | } |
| | | appBaseBathDto.setUserId(userId); |
| | | shoppingCartService.deleteShoppingCart(appBaseBathDto); |
| | | return R.ok(); |
| | | } |