From 32f925357776c46bd9e35cf9aad4fdd0f6535d1d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 22 十月 2019 09:21:35 +0800 Subject: [PATCH] 订单奖励修改 --- fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java | 88 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 76 insertions(+), 12 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 7a654ee..349e769 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 @@ -12,8 +12,10 @@ 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 { @@ -45,6 +47,42 @@ detail.setDescInfo("璁㈠崟鍙凤細" + orderId); detail.setUpdateTime(new Date()); detail.setUserInfo(new UserInfo(uid)); + detail.setOrderType(orderType); + return detail; + } + + /** + * 楗夸簡涔堣繑鍒� + * + * @param uid + * @param orderId + * @param hbId + * @param money + * @return + * @throws UserMoneyDetailException + */ + public static UserMoneyDetail createElmeFanLi(Long uid, String orderId, Long hbId, BigDecimal money) + throws UserMoneyDetailException { + + if (StringUtil.isNullOrEmpty(orderId)) + throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂负绌�"); + + if (money == null) + throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖"); + + if (uid == null) + throw new UserMoneyDetailException(1, "UID涓虹┖"); + + UserMoneyDetail detail = new UserMoneyDetail(); + detail.setCreateTime(new Date()); + detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.elmeFanli.name() + "-" + hbId)); + detail.setMoney(money); + 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; } @@ -60,7 +98,7 @@ * @return * @throws UserMoneyDetailException */ - public static UserMoneyDetail createShare(Long uid, int validCount, int weiQuanCount, int invalidCount, + public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount, BigDecimal money, Date time) throws UserMoneyDetailException { if (money == null) throw new UserMoneyDetailException(1, "杩斿埄閲戦涓虹┖"); @@ -75,7 +113,7 @@ 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()); @@ -83,9 +121,10 @@ detail.setMoney(money); detail.setTitle(timeF + UserMoneyDetailTypeEnum.share.getDesc()); detail.setType(UserMoneyDetailTypeEnum.share); - detail.setDescInfo(String.format("鏈夋晥璁㈠崟:%s绗� 缁存潈璁㈠崟:%s绗� 澶辨晥璁㈠崟:%s绗�", validCount, weiQuanCount, invalidCount)); + detail.setDescInfo(String.format("鏈夋晥璁㈠崟:%s绗� 缁存潈璁㈠崟:%s绗�", validCount, weiQuanCount)); detail.setUpdateTime(new Date()); detail.setUserInfo(new UserInfo(uid)); + detail.setOrderType(orderType); return detail; } @@ -101,7 +140,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, "杩斿埄閲戦涓虹┖"); @@ -116,7 +155,7 @@ 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()); @@ -124,10 +163,11 @@ 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)); + detail.setOrderType(orderType); return detail; } @@ -167,6 +207,7 @@ detail.setDescInfo("璁㈠崟鍙凤細" + drawBack.getOrderId()); detail.setUpdateTime(new Date()); detail.setUserInfo(new UserInfo(uid)); + detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO); return detail; } @@ -203,9 +244,10 @@ 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; } @@ -242,9 +284,10 @@ 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; } @@ -415,7 +458,7 @@ * @return * @throws UserMoneyDetailException */ - public static UserMoneyDetail createOrderReward(String orderId, BigDecimal money, UserInfo user) + public static UserMoneyDetail createOrderReward(String orderId, int orderType, BigDecimal money, UserInfo user) throws UserMoneyDetailException { if (StringUtil.isNullOrEmpty(orderId)) throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂笉鑳戒负绌�"); @@ -432,7 +475,8 @@ detail.setType(UserMoneyDetailTypeEnum.orderReward); detail.setUpdateTime(new Date()); detail.setUserInfo(user); - // detail.setDescInfo("璁㈠崟鍙�:" + orderId); + detail.setOrderType(orderType); + detail.setDescInfo("璁㈠崟鍙�:" + orderId); return detail; } @@ -445,7 +489,7 @@ * @return * @throws UserMoneyDetailException */ - public static UserMoneyDetail createRepeatStatistic(String orderId, BigDecimal money, UserInfo user) + public static UserMoneyDetail createRepeatStatistic(String orderId, int orderType, BigDecimal money, UserInfo user) throws UserMoneyDetailException { if (StringUtil.isNullOrEmpty(orderId)) throw new UserMoneyDetailException(1, "璁㈠崟鍙蜂笉鑳戒负绌�"); @@ -464,6 +508,7 @@ detail.setUpdateTime(new Date()); detail.setUserInfo(user); detail.setDescInfo("璁㈠崟鍙�:" + orderId); + detail.setOrderType(orderType); return detail; } @@ -489,4 +534,23 @@ 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; + } + } -- Gitblit v1.8.0