| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createShare(Long uid, int validCount, int weiQuanCount, int invalidCount,
|
| | | BigDecimal money, Date time) throws UserMoneyDetailException {
|
| | | public static UserMoneyDetail createShare(Long uid, int orderType, int validCount, int weiQuanCount,
|
| | | int invalidCount, 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.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔 失效订单:%s笔", validCount, weiQuanCount, invalidCount));
|
| | | 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,
|
| | | BigDecimal money, Date time) throws UserMoneyDetailException {
|
| | | public static UserMoneyDetail createInvite(Long uid, int orderType, int validCount, int weiQuanCount,
|
| | | int invalidCount, 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.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔 失效订单:%s笔", validCount, weiQuanCount, invalidCount));
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | detail.setOrderType(orderType);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setDescInfo("订单号:" + drawBack.getOrderId());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | detail.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
| | | * @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.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;
|
| | | }
|
| | |
|
| | | public static UserMoneyDetail createSystemEqualize(String desc, 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.systemEqualize.name() + "-" + System.currentTimeMillis() + "-" + user.getId()));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.systemEqualize.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.systemEqualize);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(user);
|
| | | if (!StringUtil.isNullOrEmpty(desc)) {
|
| | | detail.setDescInfo(desc);
|
| | | }
|
| | | 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;
|
| | | }
|
| | |
|