From d3a5dfe218fdee554decdd58a3c995e03bc1dec1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 11 六月 2020 14:12:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java | 81 +++++++++++++++++++++++++++++++++-------
1 files changed, 66 insertions(+), 15 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 6c3dc45..57b53ce 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
@@ -1,11 +1,13 @@
package com.yeshi.fanli.util.factory;
import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
import java.util.Date;
import com.yeshi.fanli.entity.redpack.RedPackDetail;
import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
import com.yeshi.fanli.entity.redpack.RedPackExchange;
+import com.yeshi.fanli.entity.redpack.RedPackForbidRecord;
import com.yeshi.fanli.entity.redpack.RedPackGiveRecord;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
import com.yeshi.fanli.exception.redpack.RedPackDetailException;
@@ -25,7 +27,7 @@
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(false);
- detail.setDescInfo( "绛夊緟浜哄伐瀹℃牳");
+ detail.setDescInfo("绛夊緟浜哄伐瀹℃牳");
detail.setUid(exchange.getUid());
detail.setMoney(new BigDecimal("-" + exchange.getMoney()));
detail.setType(RedPackDetailTypeEnum.redExchange);
@@ -80,7 +82,53 @@
detail.setCreateTime(new Date());
return detail;
}
+
+
+ /**
+ * 绾㈠寘灏佺
+ *
+ * @param extract
+ * @return
+ */
+ public static RedPackDetail createForbid(RedPackForbidRecord record) throws RedPackDetailException {
+ if (record == null)
+ throw new RedPackDetailException(1, "鎻愮幇璁板綍涓嶈兘涓虹┖");
+ RedPackDetail detail = new RedPackDetail();
+ detail.setDisplay(true);
+ detail.setUid(record.getUid());
+ detail.setDescInfo(record.getReason());
+ detail.setMoney(new BigDecimal("-" + record.getMoney()));
+ detail.setType(RedPackDetailTypeEnum.forbid);
+ detail.setTitle(RedPackDetailTypeEnum.forbid.getDesc());
+ detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.forbid.name() + ":" + record.getId()));
+ detail.setCreateTime(new Date());
+ return detail;
+ }
+
+
+ /**
+ * 绾㈠寘鎵i櫎
+ *
+ * @param extract
+ * @return
+ */
+ public static RedPackDetail createDeduct(RedPackForbidRecord record) throws RedPackDetailException {
+ if (record == null)
+ throw new RedPackDetailException(1, "鎻愮幇璁板綍涓嶈兘涓虹┖");
+
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ RedPackDetail detail = new RedPackDetail();
+ detail.setDisplay(true);
+ detail.setUid(record.getUid());
+ detail.setDescInfo(record.getReason());
+ detail.setMoney(new BigDecimal("-" + record.getMoney()));
+ detail.setType(RedPackDetailTypeEnum.deduct);
+ detail.setTitle(RedPackDetailTypeEnum.deduct.getDesc());
+ detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.deduct.name() + ":" + record.getUid() + format.format(new Date())));
+ detail.setCreateTime(new Date());
+ return detail;
+ }
/**
* 璧犻�佸ソ鍙嬫槑缁�
*
@@ -117,6 +165,7 @@
RedPackDetail detail = new RedPackDetail();
detail.setId(id);
detail.setDisplay(true);
+ detail.setRemark("棰嗗彇浜篒D:" + giveRecord.getReceiveUid());
detail.setType(RedPackDetailTypeEnum.giveOthersSucceed);
detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc());
detail.setIdentifyCode(
@@ -169,6 +218,7 @@
}
/**
+ * 鏉挎牀鍟嗗煄浣跨敤
*
* @param giveRecord
* @return
@@ -183,7 +233,7 @@
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(false);
detail.setUid(uid);
- detail.setMoney(money);
+ detail.setMoney(new BigDecimal(0).subtract(money));
detail.setType(RedPackDetailTypeEnum.useByShopOrder);
detail.setTitle(title);
detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.useByShopOrder.name() + "-" + orderId));
@@ -191,10 +241,10 @@
detail.setDescInfo(setName);
return detail;
}
-
-
+
/**
- * 鏂颁汉濂栧姳
+ * 鏂颁汉濂栧姳
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
@@ -202,7 +252,7 @@
public static RedPackDetail createNewUserReward(Long uid, Integer num, BigDecimal money) throws RedPackDetailException {
if (uid == null || num == null || money == null)
throw new RedPackDetailException(1, "鑾峰緱璁板綍涓嶈兘涓虹┖");
-
+ // 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(true);
detail.setUid(uid);
@@ -214,9 +264,10 @@
detail.setCreateTime(new Date());
return detail;
}
-
+
/**
* 绔嬪緱鐜伴噾
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
@@ -224,7 +275,7 @@
public static RedPackDetail createInvite(RedPackWinInvite winInvite) throws RedPackDetailException {
if (winInvite == null)
throw new RedPackDetailException(1, "鑾峰緱璁板綍涓嶈兘涓虹┖");
-
+
// 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(true);
@@ -237,9 +288,10 @@
detail.setCreateTime(new Date());
return detail;
}
-
+
/**
* 閫掑濂栧姳 + 濂藉弸瀹屾垚鍒嗕韩璁㈠崟
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
@@ -247,7 +299,7 @@
public static RedPackDetail createIncreaseReward(RedPackWinInvite winInvite) throws RedPackDetailException {
if (winInvite == null)
throw new RedPackDetailException(1, "鑾峰緱璁板綍涓嶈兘涓虹┖");
-
+
// 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(true);
@@ -260,10 +312,10 @@
detail.setCreateTime(new Date());
return detail;
}
-
-
+
/**
* 杩炵画濂栧姳 + 濂藉弸瀹屾垚鍒嗕韩璁㈠崟
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
@@ -271,7 +323,7 @@
public static RedPackDetail createSeriesReward(RedPackWinInvite winInvite) throws RedPackDetailException {
if (winInvite == null)
throw new RedPackDetailException(1, "鑾峰緱璁板綍涓嶈兘涓虹┖");
-
+
// 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
RedPackDetail detail = new RedPackDetail();
detail.setDisplay(true);
@@ -284,8 +336,7 @@
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)
--
Gitblit v1.8.0