@Override
  public List<SkuStockInMemVo> getStocksBySkuIdList(List<Long> skuIdList) {
    if (skuIdList == null || skuIdList.size() <= 0) {
      logger.error("skuIdList is null or no elements");
      return null;
    }

    List<SkuStockInMemVo> skuStockInMemVoList = new ArrayList<SkuStockInMemVo>();
    for (Long skuId : skuIdList) {
      ResponseResult<Integer> result =
          dataStore.getValueByKeyAndField(CartConstant.SKU_STOCK_NAMESPACE, String.valueOf(skuId));

      if (result.getCode() == CodeInfoClass.COMMON_FAIL
          || result.getCode() == CodeInfoClass.NOT_EXIST) {
        logger.error(
            "system err or no stockCount found in mem,skuId:"
                + skuId
                + ",code:"
                + result.getCode());
        continue;
      }
      SkuStockInMemVo vo = new SkuStockInMemVo();
      vo.setSkuId(skuId);
      vo.setStockCount(result.getResult());
      skuStockInMemVoList.add(vo);
    }
    return skuStockInMemVoList;
  }
 @Override
 public ResponseResult<Integer> getStockBySkuId(Long skuId) {
   if (skuId == null) {
     logger.error("skuId is null");
     return ResponseUtil.generateError("skuId is null");
   }
   ResponseResult<Integer> result =
       dataStore.getValueByKeyAndField(CartConstant.SKU_STOCK_NAMESPACE, String.valueOf(skuId));
   return result;
 }
  @Override
  public boolean deleteBySkuId(Long skuId) {
    if (skuId == null) {
      logger.error("skuId is null");
      return false;
    }

    ResponseResult<Integer> result =
        dataStore.deleteValueOfHashByKeyAndFieldWhenExist(
            CartConstant.SKU_STOCK_NAMESPACE, String.valueOf(skuId));

    return result.getCode() == CodeInfoClass.SUCCESS;
  }
  @Override
  public boolean insert(SkuStockInMemVo vo) {
    if (vo == null || vo.getSkuId() == null || vo.getStockCount() < 0) {
      logger.error("vo or stockCount is null,skuId:" + vo.getSkuId());
      return false;
    }

    ResponseResult<Integer> result =
        dataStore.putToHashNotExist(
            CartConstant.SKU_STOCK_NAMESPACE, String.valueOf(vo.getSkuId()), vo.getStockCount());

    return result.getCode() == CodeInfoClass.SUCCESS;
  }
  @Override
  public Integer decreaseStock(Long skuId, Integer num) {
    if (skuId == null || num == null || num <= 0) {
      logger.error("skuId,num is null or num is less than 0,skuId:" + skuId + ",num:" + num);
      return CodeInfoClass.failInt;
    }
    ResponseResult<Integer> res =
        dataStore.decreaseValueByNum(CartConstant.SKU_STOCK_NAMESPACE, String.valueOf(skuId), num);

    if (res.getCode() == CodeInfoClass.COMMON_FAIL) {
      logger.error("decreaseStock err,skuId:" + skuId + ",num:" + num);
      return CodeInfoClass.failInt;
    }
    return res.getResult();
  }