From e4e219a678bf7a9f705a8efc008db34e5f9d469e Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 18 Dec 2025 15:44:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=8E=8B=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E5=85=9C=E5=BA=95=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/GameKingRewardTask.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/activity/GameKingRewardTask.java diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/activity/GameKingRewardTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/activity/GameKingRewardTask.java new file mode 100644 index 00000000..a243c723 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/activity/GameKingRewardTask.java @@ -0,0 +1,49 @@ +package com.red.circle.other.app.scheduler.activity; + +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.component.redis.annotation.TaskCacheLock; +import com.red.circle.framework.core.dto.ReqSysOrigin; +import com.red.circle.other.app.dto.cmd.activity.RankingListQueryCmd; +import com.red.circle.other.app.service.activity.RankingActivityService; +import com.red.circle.other.domain.ranking.RankingActivityType; +import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * 游戏王排名奖励兜底任务. + */ +@Slf4j +@Component +@RequiredArgsConstructor +@ConditionalOnProperty(name = "scheduler.game-king-reward", havingValue = "true", matchIfMissing = true) +public class GameKingRewardTask { + + private final RankingActivityService rankingActivityService; + + /** + * 每5分钟执行一次,兜底发送游戏王排名奖励. + */ + @Scheduled(cron = "0 */5 * * * ?") + @TaskCacheLock(key = "GAME_KING_REWARDTASK", expireSecond = 240) + public void executeGameKingReward() { + try { + log.info("开始执行游戏王排名奖励兜底任务"); + + RankingListQueryCmd cmd = new RankingListQueryCmd(); + cmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + cmd.setActivityType(RankingActivityType.KING_GAMES.getCode()); + cmd.setTemplateId("2001207026499137537"); + cmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI")); + + rankingActivityService.getTopFourRankingWithReward(cmd); + + log.info("游戏王排名奖励兜底任务执行完成"); + } catch (Exception e) { + log.error("游戏王排名奖励兜底任务执行失败", e); + } + } +}