wangming 1 ヶ月 前
コミット
d7d6839e22

+ 1 - 0
yami-shop-api/src/main/java/com/yami/shop/api/controller/ShopCartController.java

@@ -232,6 +232,7 @@ public class ShopCartController {
     public ResponseEntity<ShopCartAmountDto> getTotalPay(@RequestBody List<Long> basketIds) {
 
         // 拿到购物车的所有item
+        //List<ShopCartItemDto> dbShopCartItems = basketService.getShopCartItems(SecurityUtils.getUser().getUserId());
         List<ShopCartItemDto> dbShopCartItems = basketService.getShopCartItems(SecurityUtils.getUser().getUserId());
 
         List<ShopCartItemDto> chooseShopCartItems = dbShopCartItems

+ 5 - 5
yami-shop-service/src/main/java/com/yami/shop/service/BasketService.java

@@ -10,16 +10,15 @@
 
 package com.yami.shop.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.yami.shop.bean.app.dto.*;
+import com.yami.shop.bean.app.dto.ShopCartDto;
+import com.yami.shop.bean.app.dto.ShopCartItemDto;
 import com.yami.shop.bean.app.param.ChangeShopCartParam;
 import com.yami.shop.bean.app.param.OrderItemParam;
 import com.yami.shop.bean.app.param.ShopCartParam;
 import com.yami.shop.bean.model.Basket;
-import io.swagger.models.auth.In;
+
+import java.util.List;
 
 /**
  * @author lgh on 2018/10/18.
@@ -35,6 +34,7 @@ public interface BasketService extends IService<Basket> {
     void deleteAllShopCartItems(String userId);
 
     List<ShopCartItemDto> getShopCartItems(String userId);
+
     List<ShopCartItemDto> getShopCartItems(String userId, Integer platform);
 
     List<ShopCartItemDto> getShopCartExpiryItems(String userId);

+ 3 - 2
yami-shop-service/src/main/java/com/yami/shop/service/impl/BasketServiceImpl.java

@@ -95,7 +95,8 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
     @Override
     public List<ShopCartItemDto> getShopCartItems(String userId) {
         // 在这个类里面要调用这里的缓存信息,并没有使用aop,所以不使用注解
-        List<ShopCartItemDto> shopCartItemDtoList = cacheManagerUtil.getCache("ShopCartItems", userId);
+        //List<ShopCartItemDto> shopCartItemDtoList = cacheManagerUtil.getCache("ShopCartItems", userId);
+        List<ShopCartItemDto> shopCartItemDtoList = Lists.newArrayList();
         if (ObjectUtils.isNotEmpty(shopCartItemDtoList)) {
             return shopCartItemDtoList;
         }
@@ -105,7 +106,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
             shopCartItemDto.setWeight(shopCartItemDto.getWeight());
             shopCartItemDto.setWeightUnit(shopCartItemDto.getWeightUnit());
         }
-        cacheManagerUtil.putCache("ShopCartItems", userId, shopCartItemDtoList);
+        //cacheManagerUtil.putCache("ShopCartItems", userId, shopCartItemDtoList);
         return shopCartItemDtoList;
     }