p-honggang.li
5 天以前 f386341ce2bb205bd056a7611d3ae678ca106e65
src/main/java/com/webmanage/service/CartService.java
@@ -19,27 +19,33 @@
    /**
     * 从购物车移除商品(Redis + 数据库)
     */
    boolean removeFromCart(String userId, String unitId, Long pricingId);
    boolean removeFromCart(String userId, String unitId, String productId, Long pricingId);
    
    /**
     * 更新购物车商品数量(Redis + 数据库)
     */
    boolean updateCartItemQuantity(String userId, String unitId, Long pricingId, Integer quantity);
    boolean updateCartItemQuantity(String userId, String unitId,String productId, Long pricingId, Integer quantity);
    /**
     * 更新购物车商品年限(Redis + 数据库)
     */
    boolean updateCartItemDuration(String userId, String unitId,String productId, Long pricingId, Integer duration);
    /**
     * 清空购物车(Redis + 数据库)
     */
    boolean clearCart(String userId, String unitId);
    boolean clearCart(String userId, String unitId,String productId);
    
    /**
     * 获取购物车信息(优先Redis,失败则从数据库加载)
     */
    CartVO getCart(String userId, String unitId);
    CartVO getCart(String userId, String unitId, String productId);
    
    /**
     * 获取购物车商品列表(优先Redis,失败则从数据库加载)
     */
    List<CartItemVO> getCartItems(String userId, String unitId);
    List<CartItemVO> getCartItems(String userId, String unitId,String productId);
    
    /**
     * 检查购物车商品库存
@@ -49,25 +55,25 @@
    /**
     * 批量删除购物车商品(Redis + 数据库)
     */
    boolean batchRemoveFromCart(String userId, String unitId, List<Long> pricingIds);
    boolean batchRemoveFromCart(String userId, String unitId, String productId,List<Long> pricingIds);
    
    /**
     * 获取购物车商品数量(优先Redis,失败则从数据库加载)
     */
    Integer getCartItemCount(String userId, String unitId);
    Integer getCartItemCount(String userId, String unitId, String productId);
    
    /**
     * 从数据库加载购物车数据到Redis
     */
    boolean loadCartFromDatabase(String userId, String unitId);
    boolean loadCartFromDatabase(String userId, String unitId, String productId);
    
    /**
     * 同步Redis数据到数据库
     */
    boolean syncCartToDatabase(String userId, String unitId);
    boolean syncCartToDatabase(String userId, String unitId, String productId);
    
    /**
     * 检查购物车数据一致性
     */
    boolean checkCartConsistency(String userId, String unitId);
    boolean checkCartConsistency(String userId, String unitId, String productId);
}