admin
2019-11-05 e021e32a6ff0ec216f69c24f7ea929798bdce4c5
fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java
@@ -7,6 +7,7 @@
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
import com.yeshi.fanli.exception.redpack.RedPackDetailException;
import com.yeshi.fanli.util.StringUtil;
@@ -24,7 +25,7 @@
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(false);
      detail.setDesc("等待人工审核");
      detail.setDescInfo( "等待人工审核");
      detail.setUid(exchange.getUid());
      detail.setMoney(new BigDecimal("-" + exchange.getMoney()));
      detail.setType(RedPackDetailTypeEnum.redExchange);
@@ -50,7 +51,7 @@
      RedPackDetail detail = new RedPackDetail();
      detail.setId(id);
      detail.setDisplay(true);
      detail.setDesc("请到账户余额中查看");
      detail.setDescInfo("请到账户余额中查看");
      detail.setType(RedPackDetailTypeEnum.redExchangePass);
      detail.setTitle(RedPackDetailTypeEnum.redExchangePass.getDesc());
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.redExchangePass.name() + ":" + exchange.getId()));
@@ -72,7 +73,7 @@
      detail.setDisplay(false);
      detail.setUid(exchange.getUid());
      detail.setMoney(exchange.getMoney());
      detail.setDesc("红包产生过程中涉嫌违规");
      detail.setDescInfo("红包产生过程中涉嫌违规");
      detail.setTitle(RedPackDetailTypeEnum.redExchangeReject.getDesc());
      detail.setType(RedPackDetailTypeEnum.redExchangeReject);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.redExchangeReject.name() + ":" + exchange.getId()));
@@ -187,7 +188,120 @@
      detail.setTitle(title);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.useByShopOrder.name() + "-" + orderId));
      detail.setCreateTime(new Date());
      detail.setDesc(setName);
      detail.setDescInfo(setName);
      return detail;
   }
   /**
    *  新人奖励
    * @param winInvite
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createNewUserReward(RedPackWinInvite winInvite) throws RedPackDetailException {
      if (winInvite == null)
         throw new RedPackDetailException(1, "获得记录不能为空");
      // 红包明细- 退回红包
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(true);
      detail.setUid(winInvite.getUid());
      detail.setMoney(winInvite.getMoney());
      detail.setDescInfo("完成首笔订单");
      detail.setTitle(RedPackDetailTypeEnum.newUserReward.getDesc());
      detail.setType(RedPackDetailTypeEnum.newUserReward);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.newUserReward.name() + ":" + winInvite.getId()));
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 立得现金
    * @param winInvite
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createInvite(RedPackWinInvite winInvite) throws RedPackDetailException {
      if (winInvite == null)
         throw new RedPackDetailException(1, "获得记录不能为空");
      // 红包明细- 退回红包
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(true);
      detail.setUid(winInvite.getUid());
      detail.setMoney(winInvite.getMoney());
      detail.setDescInfo("成功邀请好友");
      detail.setTitle(RedPackDetailTypeEnum.invite.getDesc());
      detail.setType(RedPackDetailTypeEnum.invite);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.invite.name() + ":" + winInvite.getId()));
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 递增奖励 + 好友完成分享订单
    * @param winInvite
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createIncreaseReward(RedPackWinInvite winInvite) throws RedPackDetailException {
      if (winInvite == null)
         throw new RedPackDetailException(1, "获得记录不能为空");
      // 红包明细- 退回红包
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(true);
      detail.setUid(winInvite.getUid());
      detail.setMoney(winInvite.getMoney());
      detail.setDescInfo("好友完成订单");
      detail.setTitle(RedPackDetailTypeEnum.increaseReward.getDesc());
      detail.setType(RedPackDetailTypeEnum.increaseReward);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.increaseReward.name() + ":" + winInvite.getId()));
      detail.setCreateTime(new Date());
      return detail;
   }
   /**
    * 连续奖励 + 好友完成分享订单
    * @param winInvite
    * @return
    * @throws RedPackDetailException
    */
   public static RedPackDetail createSeriesReward(RedPackWinInvite winInvite) throws RedPackDetailException {
      if (winInvite == null)
         throw new RedPackDetailException(1, "获得记录不能为空");
      // 红包明细- 退回红包
      RedPackDetail detail = new RedPackDetail();
      detail.setDisplay(true);
      detail.setUid(winInvite.getUid());
      detail.setMoney(winInvite.getMoney());
      detail.setDescInfo("好友完成订单");
      detail.setTitle(RedPackDetailTypeEnum.seriesReward.getDesc());
      detail.setType(RedPackDetailTypeEnum.seriesReward);
      detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.seriesReward.name() + ":" + winInvite.getId()));
      detail.setCreateTime(new Date());
      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;
   }