From 0612e7e4104f41c3f8b683073e08cdbb65dad44a Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 29 十月 2019 13:58:20 +0800 Subject: [PATCH] 红包相关 --- fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java | 85 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 76 insertions(+), 9 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 b30dce7..2ae0aaa 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 @@ -84,21 +84,88 @@ - public static RedPackDetail createGiveOthers(RedPackGiveRecord giveRecord, String desc, RedPackDetailTypeEnum type) throws RedPackDetailException { - if (giveRecord == null || type == null) - throw new RedPackDetailException(1, "鎻愮幇璁板綍銆佺被鍨嬩笉鑳戒负绌�"); - - // 绾㈠寘鏄庣粏- 閫�鍥炵孩鍖� + /** + * 璧犻�佸ソ鍙嬫槑缁� + * @param giveRecord + * @return + * @throws RedPackDetailException + */ + public static RedPackDetail createGiveOthers(RedPackGiveRecord giveRecord) throws RedPackDetailException { + if (giveRecord == null) + throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�"); + RedPackDetail detail = new RedPackDetail(); + detail.setDisplay(true); + detail.setUid(giveRecord.getGiveUid()); + detail.setMoney(new BigDecimal("-" + giveRecord.getAmount())); + detail.setType(RedPackDetailTypeEnum.giveOthers); + detail.setTitle(RedPackDetailTypeEnum.giveOthers.getDesc()); + detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthers.name() + ":" + giveRecord.getId())); + detail.setCreateTime(new Date()); + return detail; + } + + /** + * 璧犻�佹垚鍔� + * @param id + * @param giveRecord + * @return + * @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.setType(RedPackDetailTypeEnum.giveOthersSucceed); + detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc()); + detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId())); + detail.setCreateTime(new Date()); + return detail; + } + + + /** + * 璧犻�佸け璐� + * @param giveRecord + * @return + * @throws RedPackDetailException + */ + public static RedPackDetail createGiveOthersFail(RedPackGiveRecord giveRecord) throws RedPackDetailException { + if (giveRecord == null) + throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�"); RedPackDetail detail = new RedPackDetail(); detail.setDisplay(true); detail.setUid(giveRecord.getGiveUid()); detail.setMoney(giveRecord.getAmount()); - detail.setDesc(desc); - detail.setType(type); - detail.setTitle(type.getDesc()); - detail.setIdentifyCode(StringUtil.Md5(type.name() + ":" + giveRecord.getId())); + detail.setType(RedPackDetailTypeEnum.giveOthersFail); + detail.setTitle(RedPackDetailTypeEnum.giveOthersFail.getDesc()); + detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersFail.name() + ":" + giveRecord.getId())); detail.setCreateTime(new Date()); return detail; } + + + /** + * 璧犻�佸け璐� + * @param giveRecord + * @return + * @throws RedPackDetailException + */ + public static RedPackDetail createGiveOthersReceive(RedPackGiveRecord giveRecord) throws RedPackDetailException { + if (giveRecord == null) + throw new RedPackDetailException(1, "璧犻�佽褰曚笉鑳戒负绌�"); + RedPackDetail detail = new RedPackDetail(); + detail.setDisplay(true); + detail.setUid(giveRecord.getReceiveUid()); + detail.setMoney(giveRecord.getAmount()); + detail.setType(RedPackDetailTypeEnum.giveOthersReceive); + detail.setTitle(RedPackDetailTypeEnum.giveOthersReceive.getDesc()); + detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId())); + detail.setCreateTime(new Date()); + return detail; + } + + } -- Gitblit v1.8.0