From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期六, 18 一月 2020 12:06:27 +0800 Subject: [PATCH] 用户注册信息 --- fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 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 0844be6..e97dc28 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; @@ -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; + } /** * 璧犻�佸ソ鍙嬫槑缁� * -- Gitblit v1.8.0