From b56c7f8fa63e0150f621b02f425053ce0d48c2f1 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期五, 01 十一月 2019 11:40:05 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java |  179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 170 insertions(+), 9 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java b/fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java
index b30dce7..cd5d896 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java
+++ b/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;
 
@@ -84,21 +85,181 @@
 	
 	
 	
-	public static RedPackDetail createGiveOthers(RedPackGiveRecord giveRecord, String desc, RedPackDetailTypeEnum type) throws RedPackDetailException {
-		if (giveRecord == null || type == null)
-			throw new RedPackDetailException(1, "鎻愮幇璁板綍銆佺被鍨嬩笉鑳戒负绌�");
-		
-		// 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
+	/**
+	 * 璧犻�佸ソ鍙嬫槑缁�
+	 * @param giveRecord
+	 * @return
+	 * @throws RedPackDetailException
+	 */
+	public static RedPackDetail createGiveOthers(RedPackGiveRecord giveRecord) throws RedPackDetailException {
+		if (giveRecord == null)
+			throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�");
+		RedPackDetail detail = new RedPackDetail();
+		detail.setDisplay(true);
+		detail.setUid(giveRecord.getGiveUid());
+		detail.setMoney(new BigDecimal("-" + giveRecord.getAmount()));
+		detail.setType(RedPackDetailTypeEnum.giveOthers);
+		detail.setTitle(RedPackDetailTypeEnum.giveOthers.getDesc());
+		detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthers.name() + ":" + giveRecord.getId()));
+		detail.setCreateTime(new Date());
+		return detail;
+	}
+	
+	/**
+	 * 璧犻�佹垚鍔�
+	 * @param id
+	 * @param giveRecord
+	 * @return
+	 * @throws RedPackDetailException
+	 */
+	public static RedPackDetail createGiveOthersSucceed(Long id, RedPackGiveRecord giveRecord) throws RedPackDetailException {
+		if (giveRecord == null)
+			throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�");
+		RedPackDetail detail = new RedPackDetail();
+		detail.setId(id);
+		detail.setDisplay(true);
+		detail.setType(RedPackDetailTypeEnum.giveOthersSucceed);
+		detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc());
+		detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId()));
+		detail.setCreateTime(new Date());
+		return detail;
+	}
+	
+	
+	/**
+	 * 璧犻�佸け璐�
+	 * @param giveRecord
+	 * @return
+	 * @throws RedPackDetailException
+	 */
+	public static RedPackDetail createGiveOthersFail(RedPackGiveRecord giveRecord) throws RedPackDetailException {
+		if (giveRecord == null)
+			throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�");
 		RedPackDetail detail = new RedPackDetail();
 		detail.setDisplay(true);
 		detail.setUid(giveRecord.getGiveUid());
 		detail.setMoney(giveRecord.getAmount());
-		detail.setDesc(desc);
-		detail.setType(type);
-		detail.setTitle(type.getDesc());
-		detail.setIdentifyCode(StringUtil.Md5(type.name() + ":" + giveRecord.getId()));
+		detail.setType(RedPackDetailTypeEnum.giveOthersFail);
+		detail.setTitle(RedPackDetailTypeEnum.giveOthersFail.getDesc());
+		detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersFail.name() + ":" + giveRecord.getId()));
 		detail.setCreateTime(new Date());
 		return detail;
 	}
+	
+	
+	/**
+	 * 璧犻�佸け璐�
+	 * @param giveRecord
+	 * @return
+	 * @throws RedPackDetailException
+	 */
+	public static RedPackDetail createGiveOthersReceive(RedPackGiveRecord giveRecord) throws RedPackDetailException {
+		if (giveRecord == null)
+			throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�");
+		RedPackDetail detail = new RedPackDetail();
+		detail.setDisplay(true);
+		detail.setUid(giveRecord.getReceiveUid());
+		detail.setMoney(giveRecord.getAmount());
+		detail.setType(RedPackDetailTypeEnum.giveOthersReceive);
+		detail.setTitle(RedPackDetailTypeEnum.giveOthersReceive.getDesc());
+		detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId()));
+		detail.setCreateTime(new Date());
+		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.setDesc("瀹屾垚棣栫瑪璁㈠崟");
+		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.setDesc("鎴愬姛閭�璇峰ソ鍙�");
+		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.setDesc("濂藉弸瀹屾垚璁㈠崟");
+		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.setDesc("濂藉弸瀹屾垚璁㈠崟");
+		detail.setTitle(RedPackDetailTypeEnum.seriesReward.getDesc());
+		detail.setType(RedPackDetailTypeEnum.seriesReward);
+		detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.seriesReward.name() + ":" + winInvite.getId()));
+		detail.setCreateTime(new Date());
+		return detail;
+	}
+	
 
 }

--
Gitblit v1.8.0