|
|
@@ -74,9 +74,10 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
|
|
|
basket.setBasketDate(new Date());
|
|
|
basket.setProdId(param.getProdId());
|
|
|
basket.setShopId(param.getShopId());
|
|
|
+ basket.setChannelId(param.getChannelId());
|
|
|
basket.setUserId(userId);
|
|
|
basket.setSkuId(param.getSkuId());
|
|
|
- basket.setDistributionCardNo(param.getDistributionCardNo());
|
|
|
+// basket.setDistributionCardNo(param.getDistributionCardNo());
|
|
|
basketMapper.insert(basket);
|
|
|
}
|
|
|
|
|
|
@@ -92,39 +93,28 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
|
|
|
basketMapper.deleteAllShopCartItems(userId);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<ShopCartItemDto> getShopCartItems(String userId) {
|
|
|
- // 在这个类里面要调用这里的缓存信息,并没有使用aop,所以不使用注解
|
|
|
- //List<ShopCartItemDto> shopCartItemDtoList = cacheManagerUtil.getCache("ShopCartItems", userId);
|
|
|
-// List<ShopCartItemDto> shopCartItemDtoList = Lists.newArrayList();
|
|
|
-// if (ObjectUtils.isNotEmpty(shopCartItemDtoList)) {
|
|
|
-// return shopCartItemDtoList;
|
|
|
+// @Override
|
|
|
+// public List<ShopCartItemDto> getShopCartItems(Long channelId,String userId) {
|
|
|
+// // 在这个类里面要调用这里的缓存信息,并没有使用aop,所以不使用注解
|
|
|
+//
|
|
|
+// List<ShopCartItemDto> shopCartItemDtoList = basketMapper.getShopCartItems(userId);
|
|
|
+// for (ShopCartItemDto shopCartItemDto : shopCartItemDtoList) {
|
|
|
+// shopCartItemDto.setProductTotalAmount(Arith.mul(shopCartItemDto.getProdCount(), shopCartItemDto.getPrice()));
|
|
|
+// shopCartItemDto.setWeight(shopCartItemDto.getWeight());
|
|
|
+// shopCartItemDto.setWeightUnit(shopCartItemDto.getWeightUnit());
|
|
|
// }
|
|
|
- List<ShopCartItemDto> shopCartItemDtoList = basketMapper.getShopCartItems(userId);
|
|
|
- for (ShopCartItemDto shopCartItemDto : shopCartItemDtoList) {
|
|
|
- shopCartItemDto.setProductTotalAmount(Arith.mul(shopCartItemDto.getProdCount(), shopCartItemDto.getPrice()));
|
|
|
- shopCartItemDto.setWeight(shopCartItemDto.getWeight());
|
|
|
- shopCartItemDto.setWeightUnit(shopCartItemDto.getWeightUnit());
|
|
|
- }
|
|
|
- //cacheManagerUtil.putCache("ShopCartItems", userId, shopCartItemDtoList);
|
|
|
- return shopCartItemDtoList;
|
|
|
- }
|
|
|
+// return shopCartItemDtoList;
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
|
public List<ShopCartItemDto> getShopCartItems(String userId, Long channelId) {
|
|
|
// 在这个类里面要调用这里的缓存信息,并没有使用aop,所以不使用注解
|
|
|
-// List<ShopCartItemDto> shopCartItemDtoList = cacheManagerUtil.getCache("ShopCartItems", userId);
|
|
|
-// List<ShopCartItemDto> shopCartItemDtoList = Lists.newArrayList();
|
|
|
-// if (ObjectUtils.isNotEmpty(shopCartItemDtoList)) {
|
|
|
-// return shopCartItemDtoList;
|
|
|
-// }
|
|
|
List<ShopCartItemDto> shopCartItemDtoList = basketMapper.getShopCartItemsByPlatform(userId, channelId);
|
|
|
for (ShopCartItemDto shopCartItemDto : shopCartItemDtoList) {
|
|
|
shopCartItemDto.setProductTotalAmount(Arith.mul(shopCartItemDto.getProdCount(), shopCartItemDto.getPrice()));
|
|
|
shopCartItemDto.setWeight(shopCartItemDto.getWeight());
|
|
|
shopCartItemDto.setWeightUnit(shopCartItemDto.getWeightUnit());
|
|
|
}
|
|
|
-// cacheManagerUtil.putCache("ShopCartItems", userId, shopCartItemDtoList);
|
|
|
return shopCartItemDtoList;
|
|
|
}
|
|
|
|
|
|
@@ -203,7 +193,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem, String userId) {
|
|
|
+ public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Long> basketId, OrderItemParam orderItem, String userId,Long channelId) {
|
|
|
if (orderItem == null && CollectionUtil.isEmpty(basketId)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
@@ -212,7 +202,7 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
|
|
|
return Collections.singletonList(getShopCartItem(orderItem));
|
|
|
}
|
|
|
|
|
|
- List<ShopCartItemDto> dbShopCartItems = getShopCartItems(userId);
|
|
|
+ List<ShopCartItemDto> dbShopCartItems = getShopCartItems(userId,channelId);
|
|
|
|
|
|
// 返回购物车选择的商品信息
|
|
|
List<ShopCartItemDto> collect = dbShopCartItems
|