未知购物车的情景下,购物车内容互通问题处理。
This commit is contained in:
parent
af9ffd1cbf
commit
ec020535e2
@ -33,4 +33,8 @@ public enum CartTypeEnum {
|
||||
*/
|
||||
KANJIA;
|
||||
|
||||
public String getPrefix() {
|
||||
return "{" + this.name() + "}_";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package cn.lili.modules.order.cart.entity.enums;
|
||||
|
||||
/**
|
||||
* 交易缓存枚举
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020-03-25 2:30 下午
|
||||
*/
|
||||
public enum TradeCacheEnum {
|
||||
|
||||
//================交易=================
|
||||
|
||||
/**
|
||||
* 拼团
|
||||
*/
|
||||
PINTUAN,
|
||||
/**
|
||||
* 购物车原始数据
|
||||
*/
|
||||
CART_DATA,
|
||||
/**
|
||||
* 立即购买购物车原始数据
|
||||
*/
|
||||
BUY_NOW_CART_DATA;
|
||||
|
||||
|
||||
public String getPrefix() {
|
||||
return "{" + this.name() + "}_";
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.TradeCacheEnum;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.TradeParams;
|
||||
@ -37,7 +36,6 @@ import cn.lili.modules.promotion.entity.vos.PointsGoodsVO;
|
||||
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
||||
import cn.lili.modules.promotion.service.*;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -204,17 +202,12 @@ public class CartServiceImpl implements CartService {
|
||||
*/
|
||||
private String getOriginKey(CartTypeEnum cartTypeEnum) {
|
||||
|
||||
String cacheKey = "";
|
||||
//如果会员登录了,则要以会员id为key
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
if (cartTypeEnum.equals(CartTypeEnum.CART)) {
|
||||
cacheKey = TradeCacheEnum.CART_DATA.getPrefix() + currentUser.getId();
|
||||
} else if (cartTypeEnum.equals(CartTypeEnum.BUY_NOW)) {
|
||||
cacheKey = TradeCacheEnum.BUY_NOW_CART_DATA.getPrefix() + currentUser.getId();
|
||||
} else if (cartTypeEnum.equals(CartTypeEnum.PINTUAN)) {
|
||||
cacheKey = TradeCacheEnum.PINTUAN.getPrefix() + currentUser.getId();
|
||||
//缓存key,默认使用购物车
|
||||
if (cartTypeEnum != null) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
return cartTypeEnum.getPrefix() + currentUser.getId();
|
||||
}
|
||||
return cacheKey;
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user