admin
2019-11-05 e021e32a6ff0ec216f69c24f7ea929798bdce4c5
fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java
@@ -14,7 +14,7 @@
public class RedPackDetailFactory {
   /**
    *  红包提现
    * 红包提现
    * 
    * @param extract
    * @return
@@ -22,7 +22,7 @@
   public static RedPackDetail createExchange(RedPackExchange exchange) throws RedPackDetailException {
      if (exchange == null)
         throw new RedPackDetailException(1, "提现记录不能为空");
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(false);
      detail.setDescInfo( "等待人工审核");
@@ -35,9 +35,8 @@
      return detail;
   }
   /**
    *  红包提现通过
    * 红包提现通过
    * 
    * @param extract
    * @return
@@ -45,10 +44,10 @@
   public static RedPackDetail updateExchangePass(Long id, RedPackExchange exchange) throws RedPackDetailException {
      if (id == null)
         throw new RedPackDetailException(1, "明细ID不能为空");
      if (exchange == null)
         throw new RedPackDetailException(1, "提现记录不能为空");
      RedPackDetail detail = new RedPackDetail();
      detail.setId(id);
      detail.setDisplay(true);
@@ -58,10 +57,9 @@
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.redExchangePass.name() + ":" + exchange.getId()));
      return detail;
   }
   /**
    *  红包提现拒绝
    * 红包提现拒绝
    * 
    * @param extract
    * @return
@@ -69,7 +67,7 @@
   public static RedPackDetail createExchangeReject(RedPackExchange exchange) throws RedPackDetailException {
      if (exchange == null)
         throw new RedPackDetailException(1, "提现记录不能为空");
      // 红包明细- 退回红包
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(false);
@@ -82,11 +80,10 @@
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 赠送好友明细
    *
    * @param giveRecord
    * @return
    * @throws RedPackDetailException
@@ -104,15 +101,17 @@
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 赠送成功
    *
    * @param id
    * @param giveRecord
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createGiveOthersSucceed(Long id, RedPackGiveRecord giveRecord) throws RedPackDetailException {
   public static RedPackDetail createGiveOthersSucceed(Long id, RedPackGiveRecord giveRecord)
         throws RedPackDetailException {
      if (giveRecord == null)
         throw new RedPackDetailException(1, "赠送记录不能为空");
      RedPackDetail detail = new RedPackDetail();
@@ -120,14 +119,15 @@
      detail.setDisplay(true);
      detail.setType(RedPackDetailTypeEnum.giveOthersSucceed);
      detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc());
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId()));
      detail.setIdentifyCode(
            StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId()));
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 赠送失败
    *
    * @param giveRecord
    * @return
    * @throws RedPackDetailException
@@ -145,10 +145,10 @@
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 赠送失败
    *
    * @param giveRecord
    * @return
    * @throws RedPackDetailException
@@ -162,8 +162,33 @@
      detail.setMoney(giveRecord.getAmount());
      detail.setType(RedPackDetailTypeEnum.giveOthersReceive);
      detail.setTitle(RedPackDetailTypeEnum.giveOthersReceive.getDesc());
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId()));
      detail.setIdentifyCode(
            StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId()));
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    *
    * @param giveRecord
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createUseByShopOrder(Long orderId, Long uid, String title, String setName,
         BigDecimal money) throws RedPackDetailException {
      if (orderId == null)
         throw new RedPackDetailException(1, "订单ID不能为空");
      if (uid == null)
         throw new RedPackDetailException(1, "用户ID不能为空");
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(false);
      detail.setUid(uid);
      detail.setMoney(money);
      detail.setType(RedPackDetailTypeEnum.useByShopOrder);
      detail.setTitle(title);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.useByShopOrder.name() + "-" + orderId));
      detail.setCreateTime(new Date());
      detail.setDescInfo(setName);
      return detail;
   }
   
@@ -261,5 +286,23 @@
      return detail;
   }
   
   public static RedPackDetail createShopOrderDrawBack(Long orderId, Long uid, String title, String setName,
         BigDecimal money) throws RedPackDetailException {
      if (orderId == null)
         throw new RedPackDetailException(1, "订单ID不能为空");
      if (uid == null)
         throw new RedPackDetailException(1, "用户ID不能为空");
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(false);
      detail.setUid(uid);
      detail.setMoney(money);
      detail.setType(RedPackDetailTypeEnum.shopOrderDrawBack);
      detail.setTitle(title);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.shopOrderDrawBack.name() + "-" + orderId));
      detail.setCreateTime(new Date());
      detail.setDescInfo(setName);
      return detail;
   }
}