| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.annotation.redpack.RedPackGetVersionLimit;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | |
| | | return redPackWinInviteMapper.countRewardRecord(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @RedPackGetVersionLimit(uid = "#uid")
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void orderArriveReward(Long uid, Integer source, String orderNo) throws Exception {
|
| | | if (uid == null || source == null || orderNo == null)
|
| | | return;
|
| | |
| | | UserInfo boss = threeSaleSerivce.getBoss(uid);
|
| | | if(boss != null) {
|
| | | firstReward(uid, source, orderNo);
|
| | | firstSharedOrderRewardToBoss(boss.getId(), uid, source, orderNo);
|
| | | firstSharedOrderRewardTheMonthToBoss(boss.getId(), uid, source, orderNo);
|
| | | bossReward(boss.getId(), uid, source, orderNo);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 上级奖励
|
| | | * @param uid
|
| | | * @param teamUid
|
| | | * @param source
|
| | | * @param orderNo
|
| | | * @throws Exception
|
| | | */
|
| | | @RedPackGetVersionLimit(uid = "#uid")
|
| | | @Transactional
|
| | | private void bossReward(Long uid, Long teamUid, Integer source, String orderNo) throws Exception {
|
| | | firstSharedOrderRewardToBoss(uid, teamUid, source, orderNo);
|
| | | firstSharedOrderRewardTheMonthToBoss(uid, teamUid, source, orderNo);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 被邀请人下首单返利(下单就给):
|
| | |
| | | private void firstReward(Long uid, Integer source, String orderNo) throws Exception{
|
| | | // 奖励一次
|
| | | long total = redPackWinInviteMapper.countByUidAndType(uid, RedPackWinInviteTypeEnum.newUserReward.name());
|
| | | if (total > 1)
|
| | | if (total > 0)
|
| | | return;
|
| | |
|
| | | // 1、判断是否用户首个订单
|
| | | CommonOrderVO order = commonOrderService.firstValidOrderByUid(uid);
|
| | | if (order == null || source == order.getSourceType() || orderNo.equals(order.getOrderNo())) |
| | | if (order == null || source != order.getSourceType() || !orderNo.equals(order.getOrderNo())) |
| | | return;
|
| | |
|
| | | // 金额
|
| | |
| | | private void firstSharedOrderRewardToBoss(Long uid, Long inviteeUid, Integer source, String orderNo) throws Exception{
|
| | | // 同一队员奖励一次
|
| | | long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(uid, inviteeUid, RedPackWinInviteTypeEnum.firstSharedOrder.name());
|
| | | if (totalReward > 1)
|
| | | if (totalReward > 0)
|
| | | return;
|
| | |
|
| | | // 1、判断是否是改用户首个分享订单
|
| | | CommonOrderVO order = commonOrderService.firstValidOrderByUidAndType(inviteeUid, 2);
|
| | | if (order == null || source == order.getSourceType() || orderNo.equals(order.getOrderNo())) |
| | | if (order == null || source != order.getSourceType() || !orderNo.equals(order.getOrderNo())) |
| | | return;
|
| | |
|
| | | // 2、判断是第几个人
|
| | | long total = redPackWinInviteMapper.countByUidAndType(uid, RedPackWinInviteTypeEnum.firstSharedOrder.name());
|
| | | |
| | |
|
| | | // 计算应增加红包金额
|
| | | BigDecimal money = new BigDecimal(redPackConfigService.getValueByKey("first_shared_order"));
|
| | |
| | | */
|
| | | @Transactional
|
| | | private void firstSharedOrderRewardTheMonthToBoss(Long uid, Long inviteeUid, Integer source, String orderNo) throws Exception{
|
| | | // 1、判断是否是本月首单
|
| | | CommonOrderVO order = commonOrderService.firstValidOrderTheMonthByUidAndType(inviteeUid, 2);
|
| | | if (order == null || source == order.getSourceType() || orderNo.equals(order.getOrderNo()) ||
|
| | | // 1、判断是否是上个月首单
|
| | | CommonOrderVO order = commonOrderService.firstValidOrderLastMonthByUidAndType(inviteeUid, 2);
|
| | | if (order == null || source != order.getSourceType() || !orderNo.equals(order.getOrderNo()) ||
|
| | | order.getAccountTime() == null)
|
| | | return;
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Override
|
| | | @Transactional
|
| | | private void inviteSucceedReward(Long uid) throws Exception{
|
| | | public void inviteSucceedReward(Long uid) throws Exception{
|
| | | // 验证是否存在上级
|
| | | UserInfo boss = threeSaleSerivce.getBoss(uid);
|
| | | if(boss == null)
|
| | |
| | |
|
| | | // 同一队员奖励一次
|
| | | long totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(boss.getId(), uid, RedPackWinInviteTypeEnum.inviteSucceed.name());
|
| | | if (totalReward > 1)
|
| | | if (totalReward > 0)
|
| | | return;
|
| | |
|
| | | // 1、绑定电话号码
|