| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.common.init.UserCacheManager; |
| | | import com.matrix.core.constance.SystemErrorCode; |
| | | import com.matrix.core.constance.SystemMessageCode; |
| | | import com.matrix.core.exception.GlobleException; |
| | |
| | | @Autowired |
| | | private ShopShoppingCartDao shoppingCartDao; |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | private UserCacheManager userCacheManager; |
| | | |
| | | @Autowired |
| | | WxShopCouponService shopCouponService; |
| | |
| | | @PostMapping("/findShoppingCart") |
| | | @ResponseBody |
| | | public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) { |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo loginUser = userCacheManager.getLoginUser(); |
| | | List<ShopShoppingCart> list = shoppingCartDao.selectByCartUserId(shoppingCart.getShopId(),loginUser.getId()); |
| | | List<ShopCartVo> shopCartVoList = shoppingCartService.buildShopCart(list); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopCartVoList, shopCartVoList.size()); |
| | |
| | | public |
| | | @ResponseBody |
| | | AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId) { |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo loginUser = userCacheManager.getLoginUser(); |
| | | Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getId()); |
| | | if (userCartCount == null) { |
| | | userCartCount = 0; |
| | |
| | | |
| | | shoppingCart.setCartProductId(sku.getpId()); |
| | | |
| | | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo loginUser = userCacheManager.getLoginUser(); |
| | | shoppingCart.setCreateBy(loginUser.getOpenId()); |
| | | shoppingCart.setUpdateBy(loginUser.getOpenId()); |
| | | shoppingCart.setCartUserId(loginUser.getId()); |
| | |
| | | @ResponseBody |
| | | public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected, |
| | | @PathVariable("shopId") Long shopId) { |
| | | SysVipInfo user = redisUserLoginUtils.getLoginUser(SysVipInfo.class); |
| | | SysVipInfo user = userCacheManager.getLoginUser(); |
| | | shoppingCartDao.updateAllSelected(user.getOpenId(), shopId, isSelected); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); |
| | | } |