| | |
| | | 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;
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 红包扣除
|
| | | * |
| | | * @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;
|
| | | }
|
| | | /**
|
| | | * 赠送好友明细
|
| | | *
|
| | |
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setId(id);
|
| | | detail.setDisplay(true);
|
| | | detail.setRemark("领取人ID:" + giveRecord.getReceiveUid());
|
| | | detail.setType(RedPackDetailTypeEnum.giveOthersSucceed);
|
| | | detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc());
|
| | | detail.setIdentifyCode(
|
| | |
| | | * @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.setDescInfo("完成首笔订单");
|
| | | 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;
|
| | | }
|