| | |
| | | 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 {
|
| | |
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | * @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, "返利金额为空");
|
| | |
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
|
| | |
|
| | | 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.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔", validCount, weiQuanCount));
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | * @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, "返利金额为空");
|
| | |
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | | 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));
|
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | .Md5(UserMoneyDetailTypeEnum.fanliWeiQuan.name() + "-" + uid + "-" + drawBack.getOrderItemId()));
|
| | | detail.setMoney(new BigDecimal("0").subtract(money));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanliWeiQuan.getDesc());
|
| | | detail.setSubTitle("订单维权");
|
| | | detail.setSubTitle("订单售后");
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanliWeiQuan);
|
| | | detail.setSourceIdentifyId(drawBack.getId());
|
| | | detail.setDescInfo("订单号:" + drawBack.getOrderId());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | .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;
|
| | | }
|
| | |
|
| | |
| | | .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;
|
| | | }
|
| | |
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.extract);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(extract.getUserInfo());
|
| | | detail.setShow(false);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.extractReject);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(extract.getUserInfo());
|
| | | detail.setShow(false);// 隐藏提现失败记录
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | * @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, "订单号不能为空");
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.orderReward);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | // detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setOrderType(orderType);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | * @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, "订单号不能为空");
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | | }
|