@Override
 public int editProductById(Product product) {
   int i = this.productMapper.updateByPrimaryKeySelective(product);
   if (i > 0) {
     this.redisTemplate
         .opsForValue()
         .getOperations()
         .delete(ProductConstants.PROD_ + product.getProdId());
     ;
   }
   return product.getProdId();
 }
  @Override
  public boolean batchAuditProduct(
      List<Integer> prodIds, String auditStatus, String auditContent, String auditName) {

    Date currentDate = DateUtils.currentDate();
    Product product = new Product();
    product.setAuditStatus(auditStatus);
    if (ProductConstants.PROD_AUDIT_STATUS_PASS.equals(auditStatus)) { // 审核通过
      product.setStatus(ProductConstants.PROD_STATUS_ON);
      product.setAuditContent(AUDIT_PASS_COMMENT);
      product.setLastUpdateDate(currentDate);
      product.setLastAuditName(auditName);
      product.setLastAuditDate(currentDate);
    } else if (ProductConstants.PROD_AUDIT_STATUS_NO_PASS.equals(auditStatus)) { // 审核驳回
      product.setStatus(ProductConstants.PROD_STATUS_DOWN);
      product.setAuditContent(auditContent);
      product.setLastUpdateDate(currentDate);
      product.setLastAuditName(auditName);
      product.setLastAuditDate(currentDate);
    }

    boolean b = productMapper.batchUpdateProdByCondition(prodIds, product);
    if (b) {
      this.redisTemplate
          .opsForValue()
          .getOperations()
          .delete(ProductConstants.PROD_ + product.getProdId());
      ;
    }
    return b;
  }
  @Override
  public boolean auditProduct(
      Integer prodId, String auditStatus, String auditContent, String auditName) {

    Date currentDate = DateUtils.currentDate();
    Product product = new Product();
    product.setProdId(prodId);
    product.setAuditStatus(auditStatus);
    if (ProductConstants.PROD_AUDIT_STATUS_PASS.equals(auditStatus)) { // 审核通过
      product.setStatus(ProductConstants.PROD_STATUS_ON);
      product.setAuditContent(AUDIT_PASS_COMMENT);
      product.setLastUpdateDate(currentDate);
      product.setLastAuditName(auditName);
      product.setLastAuditDate(currentDate);
    } else if (ProductConstants.PROD_AUDIT_STATUS_NO_PASS.equals(auditStatus)) { // 审核驳回
      product.setStatus(ProductConstants.PROD_STATUS_DOWN);
      product.setAuditContent(auditContent);
      product.setLastUpdateDate(currentDate);
      product.setLastAuditName(auditName);
      product.setLastAuditDate(currentDate);
    }

    int i = productMapper.updateByPrimaryKeySelective(product);
    if (i > 0) {
      this.redisTemplate
          .opsForValue()
          .getOperations()
          .delete(ProductConstants.PROD_ + product.getProdId());
      ;
    }
    return i > 0 ? true : false;
  }
  @Override
  public Product getProductById(Integer prodId) {
    Product product =
        (Product) this.redisTemplate.opsForValue().get(ProductConstants.PROD_ + prodId);
    if (product == null) {
      product = this.productMapper.selectByPrimaryKey(prodId);
      List<Sku> skus = this.skuMapper.getSkusByProdId(prodId);
      if (null != product) {
        product.setSkus(skus);
        this.redisTemplate.opsForValue().set(ProductConstants.PROD_ + product.getProdId(), product);
      }
    }

    return product;
  }
 @Override
 public boolean cancelAuditProduct(Integer prodId) {
   Product product = new Product();
   product.setProdId(prodId);
   product.setAuditStatus(ProductConstants.PROD_AUDIT_STATUS_WAIT);
   product.setLastUpdateDate(DateUtils.currentDate());
   int i = this.productMapper.updateByPrimaryKeySelective(product);
   if (i > 0) {
     this.redisTemplate
         .opsForValue()
         .getOperations()
         .delete(ProductConstants.PROD_ + product.getProdId());
     ;
   }
   return i > 0 ? true : false;
 }
 @Override
 public int addProduct(Product product) {
   this.productMapper.insertSelective(product);
   return product.getProdId();
 }