From 3937985da1ce712df86d546ced42f7a21feada94 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 28 四月 2020 14:54:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java | 496 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 299 insertions(+), 197 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java b/fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
index 3c34806..a248b12 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
@@ -4,17 +4,18 @@
import java.util.Calendar;
import java.util.Date;
-import com.yeshi.fanli.entity.bus.user.AccountDetails;
+import com.yeshi.fanli.dto.HongBao;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
-import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
import com.yeshi.fanli.exception.money.UserMoneyDetailException;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.account.UserUtil;
public class UserMoneyDetailFactory {
@@ -24,7 +25,7 @@
* @param hongBaoList
* @return
*/
- public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType, Long hbId, BigDecimal money)
+ public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType, String hbIds, BigDecimal money)
throws UserMoneyDetailException {
if (StringUtil.isNullOrEmpty(orderId))
@@ -39,34 +40,32 @@
UserMoneyDetail detail = new UserMoneyDetail();
detail.setCreateTime(new Date());
detail.setIdentifyCode(StringUtil
- .Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId + "-" + hbId));
+ .Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId + "-" + hbIds));
detail.setMoney(money);
- detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.fanli);
- detail.setDescInfo("璁㈠崟鍙凤細" + orderId);
+ detail.setTitle(UserMoneyDetailTypeEnum.fanliNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.fanliNew);
+ detail.setDescInfo(Constant.getSourceName(orderType) + "锛�" + orderId);
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(orderType);
return detail;
}
/**
- * 鍘熸湁杩斿埄鏁版嵁鍚屾
+ * 楗夸簡涔堣繑鍒�
*
* @param uid
* @param orderId
- * @param orderType
+ * @param hbId
* @param money
* @return
* @throws UserMoneyDetailException
*/
- public static UserMoneyDetail createOldFanLi(Long uid, AccountDetails accountDetails, BigDecimal money)
+ public static UserMoneyDetail createElmeFanLi(Long uid, String orderId, Long hbId, BigDecimal money)
throws UserMoneyDetailException {
- int orderType = 1;
- String orderId = null;
- if (accountDetails.getOrderItem() == null)
- orderId = accountDetails.getId() + "";
- else
- orderId = accountDetails.getId() + "-" + accountDetails.getOrderItem().getOrderId();
+
+ if (StringUtil.isNullOrEmpty(orderId))
+ throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂负绌�");
if (money == null)
throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
@@ -75,17 +74,15 @@
throw new UserMoneyDetailException(1, "UID涓虹┖");
UserMoneyDetail detail = new UserMoneyDetail();
- detail.setCreateTime(
- new Date(TimeUtil.convertToTimeTemp(accountDetails.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
- detail.setIdentifyCode(
- StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId));
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.elmeFanli.name() + "-" + hbId));
detail.setMoney(money);
- detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.fanli);
- if (accountDetails.getOrderItem() != null)
- detail.setDescInfo("璁㈠崟鍙凤細" + accountDetails.getOrderItem().getOrderId());
+ detail.setTitle(UserMoneyDetailTypeEnum.elmeFanli.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.elmeFanli);
+ detail.setDescInfo("璁㈠崟鍙凤細" + orderId);
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(Constant.SOURCE_TYPE_ELME);
return detail;
}
@@ -101,8 +98,8 @@
* @return
* @throws UserMoneyDetailException
*/
- public static UserMoneyDetail createShare(Long uid, int validCount, int weiQuanCount, int invalidCount,
- BigDecimal money, Date time) throws UserMoneyDetailException {
+ public static UserMoneyDetail createShare(Long uid, int orderType, BigDecimal money, Date time)
+ throws UserMoneyDetailException {
if (money == null)
throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
@@ -116,17 +113,19 @@
ca.setTime(time);
ca.add(Calendar.MONTH, -1);
- String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝M鏈�");
+ String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝鏈�");
UserMoneyDetail detail = new UserMoneyDetail();
detail.setCreateTime(new Date());
- detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.share.name() + "-" + uid + "-" + timeF));
+ detail.setIdentifyCode(
+ StringUtil.Md5(UserMoneyDetailTypeEnum.share.name() + "-" + orderType + "-" + uid + "-" + timeF));
detail.setMoney(money);
- detail.setTitle(timeF + UserMoneyDetailTypeEnum.share.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.share);
- detail.setDescInfo(String.format("鏈夋晥璁㈠崟:%s绗� 缁存潈璁㈠崟:%s绗� 澶辨晥璁㈠崟:%s绗�", validCount, weiQuanCount, invalidCount));
+ detail.setTitle(UserMoneyDetailTypeEnum.shareNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.shareNew);
+ detail.setDescInfo(Constant.getSourceName(orderType) + "锛�" + timeF);
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(orderType);
return detail;
}
@@ -142,7 +141,7 @@
* @return
* @throws UserMoneyDetailException
*/
- public static UserMoneyDetail createInvite(Long uid, int validCount, int weiQuanCount, int invalidCount,
+ public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount,
BigDecimal money, Date time) throws UserMoneyDetailException {
if (money == null)
throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
@@ -157,58 +156,20 @@
ca.setTime(time);
ca.add(Calendar.MONTH, -1);
- String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝M鏈�");
+ String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
UserMoneyDetail detail = new UserMoneyDetail();
detail.setCreateTime(new Date());
- detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.invite.name() + "-" + uid + "-" + timeF));
+ detail.setIdentifyCode(
+ StringUtil.Md5(UserMoneyDetailTypeEnum.invite.name() + "-" + orderType + "-" + uid + "-" + timeF));
detail.setMoney(money);
detail.setTitle(timeF + UserMoneyDetailTypeEnum.invite.getDesc());
detail.setType(UserMoneyDetailTypeEnum.invite);
- if (validCount != 0 || weiQuanCount != 0 || invalidCount != 0)
- detail.setDescInfo(String.format("鏈夋晥璁㈠崟:%s绗� 缁存潈璁㈠崟:%s绗� 澶辨晥璁㈠崟:%s绗�", validCount, weiQuanCount, invalidCount));
+ if (validCount != 0 || weiQuanCount != 0)
+ detail.setDescInfo(String.format("鏈夋晥璁㈠崟:%s绗� 缁存潈璁㈠崟:%s绗�", validCount, weiQuanCount));
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
- return detail;
- }
-
- /**
- * 鑰佺増鏈殑鍒嗕韩鍜岄個璇疯禋鍒拌处璁板綍
- *
- * @param uid
- * @param money
- * @param time
- * @return
- * @throws UserMoneyDetailException
- */
- public static UserMoneyDetail createShareAndInvite(AccountDetails accountDetail) throws UserMoneyDetailException {
- if (accountDetail.getMoney() == null)
- throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
-
- if (accountDetail.getUserInfo() == null)
- throw new UserMoneyDetailException(1, "UID涓虹┖");
-
- if (accountDetail.getCreateTime() == null)
- throw new UserMoneyDetailException(1, "鍙戠敓鏃堕棿涓虹┖");
-
- Date time = new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
-
- Calendar ca = Calendar.getInstance();
- ca.setTime(time);
- ca.add(Calendar.MONTH, -1);
-
- String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝M鏈�");
-
- UserMoneyDetail detail = new UserMoneyDetail();
- detail.setCreateTime(
- new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
- detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.inviteAndShare.name() + "-"
- + accountDetail.getUserInfo().getId() + "-" + accountDetail.getId()));
- detail.setMoney(new BigDecimal(accountDetail.getMoney()));
- detail.setTitle(timeF + UserMoneyDetailTypeEnum.inviteAndShare.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.inviteAndShare);
- detail.setUpdateTime(new Date());
- detail.setUserInfo(accountDetail.getUserInfo());
+ detail.setOrderType(orderType);
return detail;
}
@@ -241,13 +202,14 @@
detail.setIdentifyCode(StringUtil
.Md5(UserMoneyDetailTypeEnum.fanliWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
detail.setMoney(new BigDecimal("0").subtract(money));
- detail.setTitle(UserMoneyDetailTypeEnum.fanliWeiQuan.getDesc());
- detail.setSubTitle("璁㈠崟缁存潈");
- detail.setType(UserMoneyDetailTypeEnum.fanliWeiQuan);
+ detail.setTitle(UserMoneyDetailTypeEnum.fanliWeiQuanNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.fanliWeiQuanNew);
detail.setSourceIdentifyId(drawBack.getId());
- detail.setDescInfo("璁㈠崟鍙凤細" + drawBack.getOrderId());
+ detail.setDescInfo(
+ Constant.getSourceName(Constant.SOURCE_TYPE_TAOBAO) + "锛�" + drawBack.getOrderId() + "-閮ㄥ垎鍟嗗搧鍞悗");
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
return detail;
}
@@ -281,12 +243,13 @@
.Md5(UserMoneyDetailTypeEnum.shareWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
detail.setMoney(new BigDecimal("0").subtract(money));
detail.setTitle(UserMoneyDetailTypeEnum.shareWeiQuan.getDesc());
- detail.setSubTitle("璁㈠崟缁存潈");
+ detail.setSubTitle("璁㈠崟鍞悗");
detail.setType(UserMoneyDetailTypeEnum.shareWeiQuan);
detail.setSourceIdentifyId(drawBack.getId());
- detail.setDescInfo("璁㈠崟鍙凤細" + drawBack.getOrderId());
+ detail.setDescInfo("璁㈠崟鍙凤細" + UserUtil.filterOrderId(drawBack.getOrderId()));
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
return detail;
}
@@ -320,12 +283,13 @@
.Md5(UserMoneyDetailTypeEnum.inviteWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
detail.setMoney(new BigDecimal("0").subtract(money));
detail.setTitle(UserMoneyDetailTypeEnum.inviteWeiQuan.getDesc());
- detail.setSubTitle("璁㈠崟缁存潈");
+ detail.setSubTitle("璁㈠崟鍞悗");
detail.setType(UserMoneyDetailTypeEnum.inviteWeiQuan);
detail.setSourceIdentifyId(drawBack.getId());
- detail.setDescInfo("璁㈠崟鍙凤細" + drawBack.getOrderId());
+ detail.setDescInfo("璁㈠崟鍙凤細" + UserUtil.filterOrderId(drawBack.getOrderId()));
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
return detail;
}
@@ -335,7 +299,7 @@
* @param extract
* @return
*/
- public static UserMoneyDetail createExtract(Extract extract) throws UserMoneyDetailException {
+ public static UserMoneyDetail createExtract(Extract extract, String alipayNo) throws UserMoneyDetailException {
if (extract == null)
throw new UserMoneyDetailException(1, "鎻愮幇璁板綍涓嶈兘涓虹┖");
if (extract.getId() == null)
@@ -345,15 +309,20 @@
if (extract.getUserInfo() == null || extract.getUserInfo().getId() == null)
throw new UserMoneyDetailException(1, "鎻愮幇鐢ㄦ埛涓嶈兘涓虹┖");
+ if (alipayNo != null && alipayNo.length() > 10)
+ alipayNo = "*" + alipayNo.substring(alipayNo.length() - 10, alipayNo.length());
+
UserMoneyDetail detail = new UserMoneyDetail();
detail.setCreateTime(new Date());
detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extract.name() + ":" + extract.getId()));
detail.setMoney(new BigDecimal("0").subtract(extract.getMoney()));
detail.setSourceIdentifyId(extract.getId());
- detail.setTitle(UserMoneyDetailTypeEnum.extract.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.extract);
+ detail.setTitle(UserMoneyDetailTypeEnum.extractNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.extractNew);
detail.setUpdateTime(new Date());
+ detail.setDescInfo("鏀粯瀹濊鍗曞彿锛�" + alipayNo);
detail.setUserInfo(extract.getUserInfo());
+ detail.setShow(false);
return detail;
}
@@ -379,10 +348,44 @@
detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractVerify.name() + ":" + aa.getId()));
detail.setMoney(new BigDecimal("0").subtract(money));
detail.setSourceIdentifyId(aa.getId());
- detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.extractVerify);
+ detail.setTitle(UserMoneyDetailTypeEnum.extractVerifyNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.extractVerifyNew);
detail.setUpdateTime(new Date());
detail.setUserInfo(new UserInfo(aa.getUid()));
+ detail.setDescInfo(String.format("鏀粯瀹濓細%s -濮撳悕-%s", UserUtil.filterAlipayAccount(aa.getAccount()),
+ UserUtil.filterAlipayName(aa.getName())));
+ return detail;
+ }
+
+ /**
+ * 绯荤粺鎵i櫎
+ * @Title: createSystemTakeOff
+ * @Description:
+ * @param uid
+ * @param money
+ * @param desc
+ * @return
+ * @throws UserMoneyDetailException
+ * UserMoneyDetail 杩斿洖绫诲瀷
+ * @throws
+ */
+ public static UserMoneyDetail createSystemTakeOff(Long uid, BigDecimal money, String desc)
+ throws UserMoneyDetailException {
+ if (uid == null)
+ throw new UserMoneyDetailException(1, "UID涓嶈兘涓虹┖");
+ if (money == null)
+ throw new UserMoneyDetailException(1, "閲戦涓嶈兘涓虹┖");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(
+ StringUtil.Md5(uid + "-" + UserMoneyDetailTypeEnum.systemTakeOff.name() + System.currentTimeMillis()));
+ detail.setMoney(new BigDecimal("0").subtract(money));
+ detail.setTitle(UserMoneyDetailTypeEnum.systemTakeOff.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.systemTakeOff);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(new UserInfo(uid));
+ detail.setDescInfo(desc);
return detail;
}
@@ -413,6 +416,7 @@
detail.setType(UserMoneyDetailTypeEnum.extractReject);
detail.setUpdateTime(new Date());
detail.setUserInfo(extract.getUserInfo());
+ detail.setShow(false);// 闅愯棌鎻愮幇澶辫触璁板綍
return detail;
}
@@ -488,109 +492,6 @@
}
/**
- * 鑰佺増鏈殑鏂颁汉绾㈠寘閫�娆�
- *
- * @param hb
- * @return
- * @throws UserMoneyDetailException
- */
- public static UserMoneyDetail createOldNewerHongBaoDeduct(AccountDetails accountDetails)
- throws UserMoneyDetailException {
- HongBao hb = new HongBao();
- hb.setId(accountDetails.getId());
- hb.setBeizhu("鑰佺増鏈�");
- hb.setMoney(new BigDecimal(accountDetails.getMoney()));
- hb.setUserInfo(accountDetails.getUserInfo());
- UserMoneyDetail userMoneyDetail = createHongBaoDeduct(hb, "鏂颁汉绾㈠寘鎵i櫎");
- userMoneyDetail.setId(accountDetails.getId());
- return userMoneyDetail;
- }
-
- /**
- * 鑰佺増鏈敭鍚庤鍗曟墸娆�
- *
- * @param accountDetails
- * @return
- * @throws UserMoneyDetailException
- */
- public static UserMoneyDetail createOldWeiQuan(AccountDetails accountDetails) throws UserMoneyDetailException {
- if (accountDetails == null)
- throw new UserMoneyDetailException(1, "璇︽儏涓嶈兘涓虹┖");
- if (accountDetails.getUserInfo() == null)
- throw new UserMoneyDetailException(1, "鐢ㄦ埛涓嶈兘涓虹┖");
-
- UserMoneyDetail detail = new UserMoneyDetail();
- detail.setCreateTime(new Date());
- detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.weiQuan.name() + "-" + accountDetails.getId()));
- detail.setMoney(new BigDecimal(accountDetails.getMoney()));
- detail.setTitle(UserMoneyDetailTypeEnum.weiQuan.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.weiQuan);
- detail.setUpdateTime(new Date());
- detail.setUserInfo(accountDetails.getUserInfo());
- detail.setId(accountDetails.getId());
- return detail;
- }
-
- /**
- * 鏂颁汉绾㈠寘
- *
- * @param accountDetails
- * @return
- * @throws UserMoneyDetailException
- */
-
- public static UserMoneyDetail createOldNewerHongBao(AccountDetails accountDetails) throws UserMoneyDetailException {
-
- if (accountDetails == null)
- throw new UserMoneyDetailException(1, "璇︽儏涓嶈兘涓虹┖");
- if (accountDetails.getUserInfo() == null)
- throw new UserMoneyDetailException(1, "鐢ㄦ埛涓嶈兘涓虹┖");
-
- UserMoneyDetail detail = new UserMoneyDetail();
- detail.setCreateTime(new Date());
- detail.setIdentifyCode(StringUtil
- .Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "鑰佺増鏈柊浜虹孩鍖�" + "-" + accountDetails.getId()));
- detail.setMoney(new BigDecimal(accountDetails.getMoney()));
- detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
- detail.setSubTitle("鏂颁汉绾㈠寘");
- detail.setType(UserMoneyDetailTypeEnum.hongbao);
- detail.setUpdateTime(new Date());
- detail.setUserInfo(accountDetails.getUserInfo());
- detail.setId(accountDetails.getId());
- return detail;
- }
-
- /**
- * 鑰佺増鏈彁鐜拌处鍙烽獙璇�
- *
- * @param accountDetails
- * @return
- * @throws UserMoneyDetailException
- */
- public static UserMoneyDetail createOldExtractAccountValid(AccountDetails accountDetails)
- throws UserMoneyDetailException {
-
- if (accountDetails == null)
- throw new UserMoneyDetailException(1, "楠岃瘉璁板綍涓嶈兘涓虹┖");
- if (accountDetails.getUserInfo() == null)
- throw new UserMoneyDetailException(1, "UID涓嶈兘涓虹┖");
- if (accountDetails.getMoney() == null)
- throw new UserMoneyDetailException(1, "閲戦涓嶈兘涓虹┖");
-
- UserMoneyDetail detail = new UserMoneyDetail();
- detail.setCreateTime(new Date());
- detail.setIdentifyCode(StringUtil
- .Md5(UserMoneyDetailTypeEnum.extractVerify.name() + "-" + "鑰佺増鏈�" + "-" + accountDetails.getId()));
- detail.setMoney(new BigDecimal(accountDetails.getMoney()));
- detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
- detail.setType(UserMoneyDetailTypeEnum.extractVerify);
- detail.setUpdateTime(new Date());
- detail.setUserInfo(accountDetails.getUserInfo());
- detail.setId(accountDetails.getId());
- return detail;
- }
-
- /**
* 杩斿埄濂栧姳
*
* @param orderId
@@ -599,8 +500,8 @@
* @return
* @throws UserMoneyDetailException
*/
- public static UserMoneyDetail createOrderReward(String orderId, BigDecimal money, UserInfo user)
- throws UserMoneyDetailException {
+ public static UserMoneyDetail createOrderReward(String orderId, int orderType, BigDecimal money,
+ BigDecimal originalMoney, UserInfo user) throws UserMoneyDetailException {
if (StringUtil.isNullOrEmpty(orderId))
throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂笉鑳戒负绌�");
if (user == null)
@@ -612,12 +513,213 @@
detail.setCreateTime(new Date());
detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "鑰佺増鏈�" + "-" + orderId));
detail.setMoney(money);
- detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
- detail.setSubTitle("杩斿埄濂栧姳");
- detail.setType(UserMoneyDetailTypeEnum.hongbao);
+ detail.setTitle(UserMoneyDetailTypeEnum.orderRewardNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.orderRewardNew);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(user);
+ detail.setOrderType(orderType);
+ detail.setDescInfo(Constant.getSourceName(orderType) + ":" + orderId + "-鍘熻繑鍒╋細" + originalMoney);
+ return detail;
+ }
+
+ /**
+ * 璁㈠崟閲嶅缁熻閫�娆�
+ *
+ * @param orderId
+ * @param money
+ * @param user
+ * @return
+ * @throws UserMoneyDetailException
+ */
+ public static UserMoneyDetail createRepeatStatistic(String orderId, int orderType, BigDecimal money, UserInfo user)
+ throws UserMoneyDetailException {
+ if (StringUtil.isNullOrEmpty(orderId))
+ throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂笉鑳戒负绌�");
+ if (user == null)
+ throw new UserMoneyDetailException(1, "UID涓嶈兘涓虹┖");
+ if (money == null)
+ throw new UserMoneyDetailException(1, "閲戦涓嶈兘涓虹┖");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(
+ StringUtil.Md5(UserMoneyDetailTypeEnum.repeatStatistic.name() + "-" + orderId + "-" + user.getId()));
+ detail.setMoney(money);
+ detail.setTitle(UserMoneyDetailTypeEnum.repeatStatistic.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.repeatStatistic);
detail.setUpdateTime(new Date());
detail.setUserInfo(user);
detail.setDescInfo("璁㈠崟鍙�:" + orderId);
+ detail.setOrderType(orderType);
+ return detail;
+ }
+
+ public static UserMoneyDetail createSystemEqualize(String desc, BigDecimal money, UserInfo user)
+ throws UserMoneyDetailException {
+ if (user == null)
+ throw new UserMoneyDetailException(1, "UID涓嶈兘涓虹┖");
+ if (money == null)
+ throw new UserMoneyDetailException(1, "閲戦涓嶈兘涓虹┖");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(StringUtil.Md5(
+ UserMoneyDetailTypeEnum.systemEqualize.name() + "-" + System.currentTimeMillis() + "-" + user.getId()));
+ detail.setMoney(money);
+ detail.setTitle(UserMoneyDetailTypeEnum.systemEqualizeNew.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.systemEqualizeNew);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(user);
+ if (!StringUtil.isNullOrEmpty(desc)) {
+ detail.setDescInfo(desc);
+ }
+ return detail;
+ }
+
+ public static UserMoneyDetail createScoreConvert(BigDecimal money, UserInfo user) throws UserMoneyDetailException {
+ if (user == null)
+ throw new UserMoneyDetailException(1, "UID涓嶈兘涓虹┖");
+ if (money == null)
+ throw new UserMoneyDetailException(1, "閲戦涓嶈兘涓虹┖");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(StringUtil.Md5(
+ UserMoneyDetailTypeEnum.scoreConvert.name() + "-" + System.currentTimeMillis() + "-" + user.getId()));
+ detail.setMoney(money);
+ detail.setTitle(UserMoneyDetailTypeEnum.scoreConvert.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.scoreConvert);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(user);
+
+ return detail;
+ }
+
+ /**
+ * 閭�璇峰閲戝埌璐�
+ *
+ * @param uid
+ * @param validCount
+ * @param weiQuanCount
+ * @param invalidCount
+ * @param money
+ * @param time
+ * @return
+ * @throws UserMoneyDetailException
+ */
+ public static UserMoneyDetail createInviteSubsidy(Long uid, int orderType, BigDecimal money, Date time)
+ throws UserMoneyDetailException {
+ if (money == null)
+ throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
+
+ if (uid == null)
+ throw new UserMoneyDetailException(1, "UID涓虹┖");
+
+ if (time == null)
+ throw new UserMoneyDetailException(1, "鍙戠敓鏃堕棿涓虹┖");
+
+ Calendar ca = Calendar.getInstance();
+ ca.setTime(time);
+ ca.add(Calendar.MONTH, -1);
+
+ String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(
+ StringUtil.Md5(UserMoneyDetailTypeEnum.subsidy.name() + "-" + orderType + "-" + uid + "-" + timeF));
+ detail.setMoney(money);
+ detail.setTitle(
+ timeF + UserMoneyDetailTypeEnum.subsidy.getDesc() + "銆�" + Constant.getSourceName(orderType) + "銆�");
+ detail.setType(UserMoneyDetailTypeEnum.subsidy);
+ detail.setDescInfo("閭�璇疯鍗曡ˉ璐�");
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(new UserInfo(uid));
+ detail.setOrderType(orderType);
+ return detail;
+ }
+
+ /**
+ * 鍥㈤槦鏀剁泭
+ * @Title: createTeamReward
+ * @Description:
+ * @param uid
+ * @param money
+ * @param time
+ * @return
+ * @throws UserMoneyDetailException
+ * UserMoneyDetail 杩斿洖绫诲瀷
+ * @throws
+ */
+
+ public static UserMoneyDetail createTeamReward(Long uid, BigDecimal money, Date time)
+ throws UserMoneyDetailException {
+ if (money == null)
+ throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
+
+ if (uid == null)
+ throw new UserMoneyDetailException(1, "UID涓虹┖");
+
+ if (time == null)
+ throw new UserMoneyDetailException(1, "鍙戠敓鏃堕棿涓虹┖");
+
+ Calendar ca = Calendar.getInstance();
+ ca.setTime(time);
+ ca.add(Calendar.MONTH, -1);
+
+ String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝鏈�");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.teamReward.name() + "-" + uid + "-" + timeF));
+ detail.setMoney(money);
+ detail.setTitle(UserMoneyDetailTypeEnum.teamReward.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.teamReward);
+ detail.setDescInfo(timeF);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(new UserInfo(uid));
+ return detail;
+ }
+
+
+ /**
+ * 鍥㈤槦鍒嗙孩
+ * @Title: createTeamDividents
+ * @Description:
+ * @param uid
+ * @param money
+ * @param time
+ * @return
+ * @throws UserMoneyDetailException
+ * UserMoneyDetail 杩斿洖绫诲瀷
+ * @throws
+ */
+ public static UserMoneyDetail createTeamDividents(Long uid, BigDecimal money, Date time)
+ throws UserMoneyDetailException {
+ if (money == null)
+ throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖");
+
+ if (uid == null)
+ throw new UserMoneyDetailException(1, "UID涓虹┖");
+
+ if (time == null)
+ throw new UserMoneyDetailException(1, "鍙戠敓鏃堕棿涓虹┖");
+
+ Calendar ca = Calendar.getInstance();
+ ca.setTime(time);
+ ca.add(Calendar.MONTH, -1);
+
+ String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy骞碝鏈�");
+
+ UserMoneyDetail detail = new UserMoneyDetail();
+ detail.setCreateTime(new Date());
+ detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.teamDividents.name() + "-" + uid + "-" + timeF));
+ detail.setMoney(money);
+ detail.setTitle(UserMoneyDetailTypeEnum.teamDividents.getDesc());
+ detail.setType(UserMoneyDetailTypeEnum.teamDividents);
+ detail.setDescInfo(timeF);
+ detail.setUpdateTime(new Date());
+ detail.setUserInfo(new UserInfo(uid));
return detail;
}
--
Gitblit v1.8.0