| | |
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
|
| | | import com.yeshi.fanli.util.annotation.redpack.RedPackGetVersionLimit;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | |
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @RedPackGetVersionLimit(uid = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void orderArriveReward(Long uid, Integer source, String orderNo) throws Exception {
|
| | | public void inviteOrderArriveReward(Long uid, Integer source, String orderNo) throws Exception {
|
| | | if (uid == null || source == null || StringUtil.isNullOrEmpty(orderNo))
|
| | | return;
|
| | |
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(uid, Constant.RED_PACK_REWARD_TIME);
|
| | | if(threeSale == null)
|
| | | return;
|
| | | bossReward(threeSale.getBoss().getId(), uid, source, orderNo);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 上级奖励
|
| | | * @param uid
|
| | | * @param teamUid
|
| | | * @param source
|
| | | * @param orderNo
|
| | | * @throws Exception
|
| | | */
|
| | | @Transactional
|
| | | private void bossReward(Long bossId, Long teamUid, Integer source, String orderNo) throws Exception {
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog == null) |
| | | //获取订单对应下单人
|
| | | List<CommonOrder> list = commonOrderService.listBySourceTypeAndOrderId(source, orderNo);
|
| | | if (list == null || list.isEmpty())
|
| | | return;
|
| | |
|
| | | // 小于2.0.2版本不增加
|
| | | if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode()))
|
| | | CommonOrder commonOrder = list.get(0);
|
| | | if (commonOrder == null || commonOrder.getUserInfo() == null)
|
| | | return;
|
| | | |
| | | // 下单人id
|
| | | Long teamUid = commonOrder.getUserInfo().getId();
|
| | | if (teamUid == null)
|
| | | return;
|
| | | |
| | | // 验证上下级关系
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerIdAndTime(teamUid, Constant.RED_PACK_REWARD_TIME);
|
| | | if(threeSale == null || threeSale.getBoss().getId().longValue() != uid.longValue())
|
| | | return;
|
| | |
|
| | | // 第一阶段(验证)
|
| | | RedPackWinInvite oneStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.oneStageReward.name());
|
| | | RedPackWinInvite oneStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(uid, teamUid, RedPackWinInviteTypeEnum.oneStageReward.name());
|
| | | if (oneStage == null)
|
| | | return;
|
| | |
|
| | | // 第二阶段(验证)
|
| | | RedPackWinInvite twoStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(bossId, teamUid, RedPackWinInviteTypeEnum.twoStageReward.name());
|
| | | RedPackWinInvite twoStage = redPackWinInviteMapper.getByUidAndTeamUidAndType(uid, teamUid, RedPackWinInviteTypeEnum.twoStageReward.name());
|
| | | if (twoStage == null) {
|
| | | twoStageRewardToBoss(bossId, teamUid, oneStage.getCreateTime(), source, orderNo);
|
| | | twoStageRewardToBoss(uid, teamUid, oneStage.getCreateTime(), source, orderNo);
|
| | | return;
|
| | | }
|
| | |
|
| | | // 第三阶段
|
| | | threeStageRewardToBoss(bossId, teamUid, twoStage.getCreateTime(), source, orderNo);
|
| | | threeStageRewardToBoss(uid, teamUid, twoStage.getCreateTime(), source, orderNo);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 上级奖励--第二阶段
|
| | | * @param uid
|