From 148af6b2f57be264c84d0991237fbd7ddea491a4 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 04 十一月 2019 09:55:55 +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 |   85 ++++++++++++++++++++++++++++++++----------
 1 files changed, 64 insertions(+), 21 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 90abfed..29291de 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
@@ -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;
+	}
 
 }

--
Gitblit v1.8.0