| | |
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | |
| | | * @param hongBaoList
|
| | | * @return
|
| | | */
|
| | | public static UserMoneyDetail createFanLi(Long uid, String orderId, BigDecimal money)
|
| | | public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType,Long hbId, BigDecimal money)
|
| | | throws UserMoneyDetailException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | | throw new UserMoneyDetailException(1, "订单号为空");
|
| | |
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | |
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + ":" + orderId));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId+"-"+hbId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanli);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 原有返利数据同步
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderType
|
| | | * @param money
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldFanLi(Long uid, AccountDetails accountDetails, BigDecimal money)
|
| | | throws UserMoneyDetailException {
|
| | | int orderType = 1;
|
| | | String orderId = null;
|
| | | if (accountDetails.getOrderItem() == null)
|
| | | orderId = accountDetails.getId() + "";
|
| | | else
|
| | | orderId = accountDetails.getId() + "-" + accountDetails.getOrderItem().getOrderId();
|
| | |
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (uid == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(accountDetails.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanli);
|
| | | if (accountDetails.getOrderItem() != null)
|
| | | detail.setDescInfo("订单号:" + accountDetails.getOrderItem().getOrderId());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | detail.setMoney(money);
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.invite.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.invite);
|
| | | detail.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔 失效订单:%s笔", validCount, weiQuanCount, invalidCount));
|
| | | if (validCount != 0 || weiQuanCount != 0 || invalidCount != 0)
|
| | | detail.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔 失效订单:%s笔", validCount, weiQuanCount, invalidCount));
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本的分享和邀请赚到账记录
|
| | | * |
| | | * @param uid
|
| | | * @param money
|
| | | * @param time
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createShareAndInvite(AccountDetails accountDetail) throws UserMoneyDetailException {
|
| | | if (accountDetail.getMoney() == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (accountDetail.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | if (accountDetail.getCreateTime() == null)
|
| | | throw new UserMoneyDetailException(1, "发生时间为空");
|
| | |
|
| | | Date time = new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | |
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(accountDetail.getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.inviteAndShare.name() + "-"
|
| | | + accountDetail.getUserInfo().getId() + "-" + accountDetail.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetail.getMoney()));
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.inviteAndShare.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetail.getUserInfo());
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractReject.name() + ":" + extract.getId()));
|
| | | detail.setMoney(extract.getMoney());
|
| | | detail.setSourceIdentifyId(extract.getId());
|
| | | detail.setSubTitle("原路退回");
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractReject.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractReject);
|
| | | detail.setUpdateTime(new Date());
|
| | |
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.hongbao.name() + ":" + hb.getId()));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + subTitle + "-" + hb.getId()));
|
| | | detail.setMoney(hb.getMoney());
|
| | | detail.setSourceIdentifyId(hb.getId());
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
|
| | | detail.setSubTitle(subTitle);
|
| | | detail.setType(UserMoneyDetailTypeEnum.hongbao);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(hb.getUserInfo());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | private static UserMoneyDetail createHongBaoDeduct(HongBao hb, String subTitle) throws UserMoneyDetailException {
|
| | | if (hb == null)
|
| | | throw new UserMoneyDetailException(1, "红包不能为空");
|
| | | if (hb.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "用户不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.hongbaoDeduct.name() + "-" + subTitle + "-"
|
| | | + hb.getBeizhu() + "-" + hb.getId()));
|
| | | detail.setMoney(hb.getMoney());
|
| | | detail.setSourceIdentifyId(hb.getId());
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.hongbaoDeduct.getDesc());
|
| | | detail.setSubTitle(subTitle);
|
| | | detail.setType(UserMoneyDetailTypeEnum.hongbaoDeduct);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(hb.getUserInfo());
|
| | | return detail;
|
| | |
| | |
|
| | | /**
|
| | | * 新人红包扣除
|
| | | * |
| | | * @param hb
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | |
| | |
|
| | | public static UserMoneyDetail createNewerHongBaoDeduct(HongBao hb) throws UserMoneyDetailException {
|
| | | return createHongBao(hb, "新人红包扣除");
|
| | | return createHongBaoDeduct(hb, "新人红包扣除");
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 老版本的新人红包退款
|
| | | * |
| | | * @param hb
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldNewerHongBaoDeduct(AccountDetails accountDetails)
|
| | | throws UserMoneyDetailException {
|
| | | HongBao hb = new HongBao();
|
| | | hb.setId(accountDetails.getId());
|
| | | hb.setBeizhu("老版本");
|
| | | hb.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | hb.setUserInfo(accountDetails.getUserInfo());
|
| | | UserMoneyDetail userMoneyDetail = createHongBaoDeduct(hb, "新人红包扣除");
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | return userMoneyDetail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本售后订单扣款
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldWeiQuan(AccountDetails accountDetails) throws UserMoneyDetailException {
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "详情不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "用户不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.weiQuan.name() + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.weiQuan.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.weiQuan);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新人红包
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | |
|
| | | public static UserMoneyDetail createOldNewerHongBao(AccountDetails accountDetails) throws UserMoneyDetailException {
|
| | |
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "详情不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "用户不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil
|
| | | .Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "老版本新人红包" + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
|
| | | detail.setSubTitle("新人红包");
|
| | | detail.setType(UserMoneyDetailTypeEnum.hongbao);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 老版本提现账号验证
|
| | | * |
| | | * @param accountDetails
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createOldExtractAccountValid(AccountDetails accountDetails)
|
| | | throws UserMoneyDetailException {
|
| | |
|
| | | if (accountDetails == null)
|
| | | throw new UserMoneyDetailException(1, "验证记录不能为空");
|
| | | if (accountDetails.getUserInfo() == null)
|
| | | throw new UserMoneyDetailException(1, "UID不能为空");
|
| | | if (accountDetails.getMoney() == null)
|
| | | throw new UserMoneyDetailException(1, "金额不能为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil
|
| | | .Md5(UserMoneyDetailTypeEnum.extractVerify.name() + "-" + "老版本" + "-" + accountDetails.getId()));
|
| | | detail.setMoney(new BigDecimal(accountDetails.getMoney()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractVerify.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractVerify);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(accountDetails.getUserInfo());
|
| | | detail.setId(accountDetails.getId());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|