diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java index a3a9eb71..e8489605 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/task/TaskListener.java @@ -358,16 +358,6 @@ public class TaskListener implements MessageListener { } - private void dealRechargeCommission(TaskApprovalEvent eventBody) { - if (StringUtils.isNotBlank(eventBody.getSysOrigin()) && eventBody.getCurrencyDiff() > 0L) { - try { - inviteUserGateway.getRechargeCommission(BigDecimal.valueOf(eventBody.getCurrencyDiff()), eventBody.getSysOrigin(), eventBody.getUserId()); - } catch (Exception e) { - log.error("被邀请人充值邀请人获得佣金累计错误: {}", Throwables.getStackTraceAsString(e)); - } - } - } - private void handleTask7(TaskApprovalEvent eventBody) { log.warn("处理任务-10 加入3个房间: {}", eventBody); // // 进入一次 +1 diff --git a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/ranking/RankingActivityType.java b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/ranking/RankingActivityType.java index f340cbef..9ca56ca9 100644 --- a/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/ranking/RankingActivityType.java +++ b/rc-service/rc-service-other/other-domain/src/main/java/com/red/circle/other/domain/ranking/RankingActivityType.java @@ -52,6 +52,8 @@ public enum RankingActivityType { CHRISTMAS(12, "圣诞节活动", "统计送礼物消费排行"), RAMADAN(13, "'斋月活动'", "'统计送礼物消费排行'"), + + INVITE(14, "'邀请活动'", "'邀请用户奖励金币排行'"), ; /** diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java index 4d551a02..9787457b 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/InviteUserGatewayImpl.java @@ -5,11 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.domain.ranking.RankingActivityType; +import com.red.circle.other.domain.ranking.RankingCycleType; +import com.red.circle.other.domain.ranking.RankingDimension; +import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord; import com.red.circle.other.infra.database.rds.dao.user.user.UserInviteUserDAO; import com.red.circle.other.infra.database.rds.entity.user.user.InviteUserRechargeCommission; import com.red.circle.other.infra.database.rds.entity.user.user.OneTimeTask; import com.red.circle.other.infra.database.rds.entity.user.user.UserInviteUser; import com.red.circle.other.infra.database.rds.service.user.user.OneTimeTaskService; +import com.red.circle.other.infra.gateway.RankingActivityGateway; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.other.domain.gateway.user.ability.InviteUserGateway; @@ -26,6 +31,7 @@ import java.time.LocalDateTime; import java.util.List; import java.util.Objects; +import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient; import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd; import com.red.circle.wallet.inner.model.enums.GoldOrigin; @@ -50,6 +56,7 @@ public class InviteUserGatewayImpl implements InviteUserGateway { private final UserProfileGateway userProfileGateway; private final InviteUserRechargeCommissionService inviteUserRechargeCommissionService; private final OneTimeTaskService oneTimeTaskService; + private final RankingActivityGateway rankingActivityGateway; /** * 被邀请人充值邀请人获得佣金 @@ -113,8 +120,24 @@ public class InviteUserGatewayImpl implements InviteUserGateway { } awardCommission(sysOrigin, userInviteUser.getUserId(), commission, userInviteUser.getInviteUserId()); + + recordRanking(userInviteUser.getUserId(), commission.longValue()); } + private void recordRanking(Long userId, Long quantity) { + RankingActivityRecord record = new RankingActivityRecord(); + record.setSysOrigin(SysOriginPlatformEnum.LIKEI.name()); + record.setUserId(userId); + record.setUserSex(1); + record.setActivityType(RankingActivityType.INVITE); + record.setCycleType(RankingCycleType.WEEKLY); + record.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + record.setDimension(RankingDimension.CONSUME_AMOUNT); + record.setExpiredTime(new Timestamp(System.currentTimeMillis() + 30L * 24 * 60 * 60 * 1000)); + // 累计数据 + rankingActivityGateway.accumulateRankingData(record, quantity); + } + /** * 奖励佣金 *