diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java index e04c318c..fdd09597 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/gift/GameLuckyGiftCommon.java @@ -17,13 +17,19 @@ import com.red.circle.external.inner.model.cmd.message.BroadcastGroupMsgBodyCmd; import com.red.circle.external.inner.model.cmd.message.CustomGroupMsgBodyCmd; import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum; import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.dto.ReqSysOrigin; import com.red.circle.mq.business.model.event.gift.GameLuckyGiftBusinessEvent; import com.red.circle.mq.business.model.event.gift.GameLuckyGiftUser; import com.red.circle.mq.rocket.business.streams.GameLuckyGiftBusinessSink; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMsgCO; +import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd; +import com.red.circle.other.app.service.activity.RankingActivityService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +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.config.LuckyGiftApiConfig; import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftConfigCache; import com.red.circle.other.infra.database.cache.entity.game.luckgift.GameLuckyGiftInventoryCache; @@ -35,7 +41,6 @@ import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftCount; import com.red.circle.other.infra.database.rds.entity.game.GameLuckyGiftRuleConfig; import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbability; import com.red.circle.other.infra.database.rds.entity.game.LuckyGiftProbabilityDetails; -import com.red.circle.other.infra.database.rds.entity.sys.EnumConfig; import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftCountService; import com.red.circle.other.infra.database.rds.service.game.GameLuckyGiftRuleConfigService; import com.red.circle.other.infra.database.rds.service.game.LuckyGiftProbabilityDetailsService; @@ -69,7 +74,6 @@ import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** @@ -96,7 +100,7 @@ public class GameLuckyGiftCommon { private final GameLuckyGiftRuleConfigService gameLuckyGiftRuleConfigService; private final LuckyGiftProbabilityDetailsService luckyGiftProbabilityDetailsService; private final LuckyGiftApiConfig luckyGiftApiConfig; - + private final RankingActivityService rankingActivityService; /** * 发送幸运礼物抽奖mq. @@ -335,11 +339,27 @@ public class GameLuckyGiftCommon { // 发送中奖金币 BigDecimal balance = sendGold(param.getUserId(), param.getSysOrigin(), awardAmount); + getDataUpdateCmd(param.getUserId(), awardAmount); + // 发送中奖通知 sendMsg(param, multiple, balance, awardAmount); } + private void getDataUpdateCmd(Long userId, Long actualAmount) { + RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd(); + receiverCmd.setUserId(userId); + receiverCmd.setUserSex(1); + receiverCmd.setActivityType(RankingActivityType.LUCK_GIFT.getCode()); + receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode()); + receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + receiverCmd.setDimension(RankingDimension.CONSUME_AMOUNT.getCode()); + receiverCmd.setIncrementQuantity(actualAmount); + receiverCmd.setBizNo(IdWorkerUtils.getIdStr()); + receiverCmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI")); + rankingActivityService.accumulateRankingData(receiverCmd); + } + /** * 开启全部模式的情况下抽奖. * diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/RankCountStrategy.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/RankCountStrategy.java index 07bf74d6..35902243 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/RankCountStrategy.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/RankCountStrategy.java @@ -431,8 +431,8 @@ public class RankCountStrategy implements GiftStrategy { return false; } - if (RankingActivityType.LUCK_GIFT == activityType) { - return Boolean.TRUE.equals(runningWater.getLuckyGift()); + if (!activityType.isValid()) { + return false; } // 默认规则 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 48d759df..e78dc5a5 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 @@ -3,6 +3,9 @@ package com.red.circle.other.domain.ranking; import lombok.AllArgsConstructor; import lombok.Getter; +import java.util.Arrays; +import java.util.List; + /** * 排行榜活动类型枚举 * @@ -43,6 +46,11 @@ public enum RankingActivityType { LUCK_GIFT(9999, "LuckGift", "统计送幸运礼物排行"), ; + /** + * 无效活动类型列表 + */ + private static final List INVALID_TYPES = Arrays.asList(LUCK_GIFT, GREEDY_GAME); + /** * 类型编码 */ @@ -90,7 +98,7 @@ public enum RankingActivityType { /** * 判断是否是有效的活动类型 */ - public static boolean isValid(Integer code) { - return getByCode(code) != null; + public boolean isValid() { + return !INVALID_TYPES.contains(this); } } \ No newline at end of file