From afe830f313e0508f716ade65d5322447c7ec676b Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 30 Mar 2026 10:45:27 +0800 Subject: [PATCH] =?UTF-8?q?cp=E6=A6=9C=E8=BE=B9=E7=95=8C=E5=80=BC=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circle/other/app/scheduler/cp/CpRankingBadgeTask.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/cp/CpRankingBadgeTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/cp/CpRankingBadgeTask.java index ffcd3784..2e716998 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/cp/CpRankingBadgeTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/cp/CpRankingBadgeTask.java @@ -46,11 +46,10 @@ public class CpRankingBadgeTask { @TaskCacheLock(key = "CP_RANKING_BADGE_TASK", expireSecond = 20) public void sendWeekRankingReward() { try { - // 1. 获取本周前三名CP对 + // 1. 获取本周前三名CP对(为空时不return,继续执行收回逻辑) List thisWeekTop3 = weekCpValueCountService.listThisWeekTop(SysOriginPlatformEnum.ATYOU.name(), 3); if (CollectionUtils.isEmpty(thisWeekTop3)) { - log.warn("CP排名徽章任务:本周前三名数据为空"); - return; + log.warn("CP排名徽章任务:本周前三名数据为空,将收回所有旧徽章"); } // 2. 查询所有持有CP排名徽章的用户 @@ -63,9 +62,10 @@ public class CpRankingBadgeTask { // 3. 构建"用户应得徽章集合":Map> // 一个用户可能在多对CP中,所以可以有多个徽章 + // 本周无数据时为空Map,后续收回逻辑会清空所有旧徽章 Map> userShouldHaveBadgesMap = new HashMap<>(); - for (int rank = 0; rank < thisWeekTop3.size() && rank < 3; rank++) { + for (int rank = 0; !CollectionUtils.isEmpty(thisWeekTop3) && rank < thisWeekTop3.size() && rank < 3; rank++) { WeekCpValueCount rankingData = thisWeekTop3.get(rank); Long badgeId = CP_BADGE_IDS[rank];