From dcfd801ea435c1c87ed47f2ee24cdabaaf230d6f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 31 三月 2020 12:15:56 +0800
Subject: [PATCH] 大淘客商品过滤修改
---
fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java | 179 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 136 insertions(+), 43 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 cd5d896..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;
@@ -14,7 +16,7 @@
public class RedPackDetailFactory {
/**
- * 绾㈠寘鎻愮幇
+ * 绾㈠寘鎻愮幇
*
* @param extract
* @return
@@ -22,10 +24,10 @@
public static RedPackDetail createExchange(RedPackExchange exchange) throws RedPackDetailException {
if (exchange == null)
throw new RedPackDetailException(1, "鎻愮幇璁板綍涓嶈兘涓虹┖");
-
+
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);
@@ -35,9 +37,8 @@
return detail;
}
-
/**
- * 绾㈠寘鎻愮幇閫氳繃
+ * 绾㈠寘鎻愮幇閫氳繃
*
* @param extract
* @return
@@ -45,23 +46,22 @@
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);
- detail.setDesc("璇峰埌璐︽埛浣欓涓煡鐪�");
+ detail.setDescInfo("璇峰埌璐︽埛浣欓涓煡鐪�");
detail.setType(RedPackDetailTypeEnum.redExchangePass);
detail.setTitle(RedPackDetailTypeEnum.redExchangePass.getDesc());
detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.redExchangePass.name() + ":" + exchange.getId()));
return detail;
}
-
-
+
/**
- * 绾㈠寘鎻愮幇鎷掔粷
+ * 绾㈠寘鎻愮幇鎷掔粷
*
* @param extract
* @return
@@ -69,13 +69,13 @@
public static RedPackDetail createExchangeReject(RedPackExchange exchange) throws RedPackDetailException {
if (exchange == null)
throw new RedPackDetailException(1, "鎻愮幇璁板綍涓嶈兘涓虹┖");
-
+
// 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖�
RedPackDetail detail = new RedPackDetail();
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()));
@@ -84,9 +84,54 @@
}
+ /**
+ * 绾㈠寘灏佺
+ *
+ * @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;
+ }
+ /**
* 璧犻�佸ソ鍙嬫槑缁�
+ *
* @param giveRecord
* @return
* @throws RedPackDetailException
@@ -104,30 +149,34 @@
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();
detail.setId(id);
detail.setDisplay(true);
+ detail.setRemark("棰嗗彇浜篒D:" + giveRecord.getReceiveUid());
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 +194,10 @@
detail.setCreateTime(new Date());
return detail;
}
-
-
+
/**
* 璧犻�佸け璐�
+ *
* @param giveRecord
* @return
* @throws RedPackDetailException
@@ -162,37 +211,63 @@
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(new BigDecimal(0).subtract(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;
+ }
+
+ /**
+ * 鏂颁汉濂栧姳
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
*/
- public static RedPackDetail createNewUserReward(RedPackWinInvite winInvite) throws RedPackDetailException {
- if (winInvite == null)
+ 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(winInvite.getUid());
- detail.setMoney(winInvite.getMoney());
- detail.setDesc("瀹屾垚棣栫瑪璁㈠崟");
+ detail.setUid(uid);
+ detail.setMoney(money);
+ detail.setDescInfo("绛惧埌绾㈠寘");
detail.setTitle(RedPackDetailTypeEnum.newUserReward.getDesc());
detail.setType(RedPackDetailTypeEnum.newUserReward);
- detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.newUserReward.name() + ":" + winInvite.getId()));
+ detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.newUserReward.name() + ":" + uid +"_" + num));
detail.setCreateTime(new Date());
return detail;
}
-
+
/**
* 绔嬪緱鐜伴噾
+ *
* @param winInvite
* @return
* @throws RedPackDetailException
@@ -200,22 +275,23 @@
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.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
@@ -223,23 +299,23 @@
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.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
@@ -247,19 +323,36 @@
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.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;
+ }
}
--
Gitblit v1.8.0