From 769e7544d4cbe19339ab6a967d8b622cc86f0f73 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 26 Dec 2025 19:05:19 +0800 Subject: [PATCH] =?UTF-8?q?fruitParty=20=E5=92=8C=20christmas=20=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E9=97=B4=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/query/RankingListQryExe.java | 4 ++++ .../gift/strategy/RankCountStrategy.java | 11 ++++++++--- .../app/service/game/HotGameServiceImpl.java | 19 ++++++++++++++++++- .../other-start/src/test/java/ApiTest.java | 13 ++++++++++--- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java index e0a17b31..8a1c3c29 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java @@ -50,6 +50,10 @@ public class RankingListQryExe { public RankingListCO execute(RankingListQueryCmd cmd) { // 获取枚举 RankingActivityType activityType = RankingActivityType.getByCode(cmd.getActivityType()); + if (activityType == RankingActivityType.CHRISTMAS || activityType == RankingActivityType.FRUIT_PARTY) { + cmd.setCycleKey("20251222"); + } + RankingCycleType cycleType = cmd.getCycleType() != null ? RankingCycleType.getByCode(cmd.getCycleType()) : RankingCycleType.WEEKLY; ActivityConfigDTO activityConfigDTO = ResponseAssert.requiredSuccess(sysActivityConfigClient.effectiveActivityByTemplate(-1L, activityType.name())); 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 afe50c78..d0b631a6 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 @@ -366,17 +366,22 @@ public class RankCountStrategy implements GiftStrategy { return; } - // 生成本周周一的cycleKey(格式:yyyyMMdd) - String cycleKey = generateWeeklyCycleKey(); - // 计算实际金额 Long actualAmount = getActualAmount(isLuckyGift, runningWater.getGiftValue().getActualAmount(), luckyGiftRatio); // 遍历活动,找到对应的type再累计对应活动类型的数据 for (ActivityConfig activity : ongoingActivities) { + String cycleKey = generateWeeklyCycleKey(); + if (!matchActivityRule(runningWater, activity)) { continue; } + + //圣诞节特殊处理 + RankingActivityType type = RankingActivityType.getByConstantName(activity.getActivityType()); + if (type == RankingActivityType.CHRISTMAS) { + cycleKey = "20251222"; + } // 将活动类型转换为RankingActivityType枚举 try { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java index eeb6a9cf..ece075ec 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/HotGameServiceImpl.java @@ -42,6 +42,7 @@ import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; +import com.red.circle.tool.core.date.ZonedId; import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.num.ArithmeticUtils; import com.red.circle.tool.core.parse.DataTypeUtils; @@ -55,6 +56,10 @@ import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO; import com.red.circle.wallet.inner.model.enums.GoldOrigin; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.ZonedDateTime; +import java.time.chrono.ChronoZonedDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; import java.util.Objects; @@ -89,6 +94,8 @@ public class HotGameServiceImpl implements HotGameService { private final RankingActivityService rankingActivityService; @Value("${red-circle.game-rank.gameid}") private String gameId; + @Value("${red-circle.game-rank.endTime}") + private String endTime; @Override public HotGameResponse getUserProfile(HotGameUserProfileQuery query) { @@ -248,13 +255,17 @@ public class HotGameServiceImpl implements HotGameService { } private void incGameRankingTmpActivity(HotGameUserCoinUpdate request) { + if (ZonedDateTimeAsiaRiyadhUtils.now().isAfter(getFinishTime())) { + return; + } + if (gameId != null && gameId.equals(request.getGameId()) && request.getType() == 2 && request.getCoin() > 0) { RankingDataUpdateCmd receiverCmd = new RankingDataUpdateCmd(); receiverCmd.setUserId(DataTypeUtils.toLong(request.getUid())); receiverCmd.setUserSex(1); receiverCmd.setActivityType(RankingActivityType.FRUIT_PARTY.getCode()); receiverCmd.setCycleType(RankingCycleType.WEEKLY.getCode()); - receiverCmd.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString()); + receiverCmd.setCycleKey("20251222"); receiverCmd.setDimension(RankingDimension.GAME_WIN.getCode()); receiverCmd.setIncrementQuantity(request.getCoin()); receiverCmd.setBizNo(request.getGameId()); @@ -263,6 +274,12 @@ public class HotGameServiceImpl implements HotGameService { } } + private ZonedDateTime getFinishTime() { + return ZonedDateTime.of(LocalDateTime.parse(endTime, + DateTimeFormatter.ISO_LOCAL_DATE_TIME), + ZonedId.ASIA_RIYADH.getZonedId()); + } + private void incGameRankingRecord(HotGameUserCoinUpdate request, GameListConfig gameListConfig) { if (request.getType() != 2 || gameListConfig == null || request.getCoin() <= 0) { return; diff --git a/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java b/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java index 01997348..8d205a9d 100644 --- a/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java +++ b/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java @@ -2,12 +2,14 @@ import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.other.infra.database.mongo.service.team.TeamBillCycleUtils; import com.red.circle.other.inner.asserts.user.UserSpecialErrorCode; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; +import com.red.circle.tool.core.date.ZonedId; import com.red.circle.tool.crypto.SecurityUtils; import org.junit.Test; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import static com.red.circle.other.infra.database.mongo.service.team.TeamBillCycleUtils.getCalcBillBelong; @@ -16,12 +18,17 @@ public class ApiTest { @Test public void testPassword() { - String account = "445566"; - System.out.println(account.matches("^\\d{8}$")); - System.out.println(account.matches("^\\d{2}$")); + System.out.println(ZonedDateTimeAsiaRiyadhUtils.now()); + System.out.println(ZonedDateTime.of(LocalDateTime.parse("2026-01-03T00:00:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME), ZonedId.ASIA_RIYADH.getZonedId())); + System.out.println(ZonedDateTimeAsiaRiyadhUtils.now().isAfter(getFinishTime())); } + private ZonedDateTime getFinishTime() { + return ZonedDateTime.of(LocalDateTime.parse("2026-01-03T00:00:00", DateTimeFormatter.ISO_LOCAL_DATE_TIME), ZonedId.ASIA_RIYADH.getZonedId()); + } + + @Test public void test() { String[] strings = TeamBillCycleUtils.parseBillBelongToDateRange(20251001);