游戏王活动 新增兜底定时任务
This commit is contained in:
parent
2c28ec5135
commit
e4e219a678
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user