From ef245908f4c4150a7e8a3405b1184fbfaa24b9ec Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 11 Feb 2026 15:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=A5=E8=8A=82=E6=B8=B8=E6=88=8F=E5=92=8C?= =?UTF-8?q?=E7=A4=BC=E7=89=A9=E6=8E=92=E8=A1=8C=E6=A6=9C=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/inner/model/enums/MonthlyRechargeType.java | 5 +++++ .../adapter/app/game/party3rd/GameHkysRestController.java | 3 ++- .../app/command/activity/ActivityRechargeRankExe.java | 7 ++++++- .../circle/other/app/common/gift/GameLuckyGiftCommon.java | 3 ++- .../service/activity/ActivityRechargeTicketService.java | 4 ++-- .../other/app/service/game/GameBaishunServiceImpl.java | 3 ++- .../circle/other/app/service/game/HotGameServiceImpl.java | 3 ++- .../circle/other/app/service/game/YomiGameServiceImpl.java | 3 ++- .../database/rds/dao/activity/UserActivityRechargeDAO.java | 2 +- .../resources/dao/activity/UserActivityRechargeDAO.xml | 3 +++ .../other-start/src/test/java/RedisTest.java | 3 ++- 11 files changed, 29 insertions(+), 10 deletions(-) diff --git a/rc-service/rc-inner-api/order-inner/order-inner-model/src/main/java/com/red/circle/order/inner/model/enums/MonthlyRechargeType.java b/rc-service/rc-inner-api/order-inner/order-inner-model/src/main/java/com/red/circle/order/inner/model/enums/MonthlyRechargeType.java index 71dd5d4e..cf96023c 100644 --- a/rc-service/rc-inner-api/order-inner/order-inner-model/src/main/java/com/red/circle/order/inner/model/enums/MonthlyRechargeType.java +++ b/rc-service/rc-inner-api/order-inner/order-inner-model/src/main/java/com/red/circle/order/inner/model/enums/MonthlyRechargeType.java @@ -79,6 +79,11 @@ public enum MonthlyRechargeType { */ SYSTEM_BACKEND_SEND, + /** + * 幸运礼物获胜 + */ + LUCKY_WIN, + /** * 未定义. */ diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java index d066bfe5..a15895bf 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/game/party3rd/GameHkysRestController.java @@ -23,6 +23,7 @@ import com.red.circle.framework.core.security.UserCredential; import com.red.circle.framework.web.annotation.IgnoreResultResponse; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.dto.cmd.game.GameLxwlUpdateBalanceCmd; @@ -196,7 +197,7 @@ public class GameHkysRestController { gameActivityService.handleGameSpendTask(userId, cmd.getCoin()); // 累加用户获得的金币并发送抽奖券 - activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(cmd.getCoin())); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(cmd.getCoin()), MonthlyRechargeType.UNDEFINED); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRechargeRankExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRechargeRankExe.java index 2570a2c7..f7c0879c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRechargeRankExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityRechargeRankExe.java @@ -2,6 +2,7 @@ package com.red.circle.other.app.command.activity; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.activity.ActivityRechargeRankCO; import com.red.circle.other.app.dto.clientobject.activity.UserRechargeRankCO; @@ -38,7 +39,11 @@ public class ActivityRechargeRankExe { public ActivityRechargeRankCO execute(ActivityRechargeRankCmd cmd) { Page page = new Page<>(cmd.getPageNo(), cmd.getPageSize()); - IPage rankPage = userActivityRechargeDAO.pageRechargeRank(page, cmd.getActivityId()); + String rechargeType = null; + if (FIXED_ACTIVITY_ID.equals(cmd.getActivityId())) { + rechargeType = MonthlyRechargeType.LUCKY_WIN.name(); + } + IPage rankPage = userActivityRechargeDAO.pageRechargeRank(page, cmd.getActivityId(), rechargeType); ActivityRechargeRankCO result = new ActivityRechargeRankCO(); 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 cd4099b1..940fff2a 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 @@ -25,6 +25,7 @@ import com.red.circle.mq.business.model.event.gift.GiveAwayGiftRoomAccepts; import com.red.circle.mq.rocket.business.producer.GiftMqMessage; import com.red.circle.mq.rocket.business.service.MessageSenderService; import com.red.circle.mq.rocket.business.streams.GameLuckyGiftBusinessSink; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.material.GiftAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMsgCO; @@ -259,7 +260,7 @@ public class GameLuckyGiftCommon { } // 累加用户获得的金币并发送抽奖券 - activityRechargeTicketService.accumulatedRechargeAndAddTicket(param.getUserId(), rewardAmount); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(param.getUserId(), rewardAmount, MonthlyRechargeType.LUCKY_WIN); } @NotNull diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/ActivityRechargeTicketService.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/ActivityRechargeTicketService.java index e158a49f..3fff8a41 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/ActivityRechargeTicketService.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/ActivityRechargeTicketService.java @@ -34,7 +34,7 @@ public class ActivityRechargeTicketService { */ private static final long TICKET_THRESHOLD = 100000L; - public void accumulatedRechargeAndAddTicket(Long userId, Long rewardAmount) { + public void accumulatedRechargeAndAddTicket(Long userId, Long rewardAmount, MonthlyRechargeType type) { // 1. 先累加金币到数据库 LocalDate today = ZonedDateTimeAsiaRiyadhUtils.now().toLocalDate(); String rechargeDate = today.toString(); @@ -42,7 +42,7 @@ public class ActivityRechargeTicketService { userId, FIXED_ACTIVITY_ID, rechargeDate, - MonthlyRechargeType.UNDEFINED.name(), + type.name(), BigDecimal.valueOf(rewardAmount) ); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java index 79d16724..78bc8937 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/GameBaishunServiceImpl.java @@ -24,6 +24,7 @@ import com.red.circle.framework.core.exception.ResponseException; import com.red.circle.framework.core.security.UserCredential; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd; import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; @@ -226,7 +227,7 @@ public class GameBaishunServiceImpl implements GameBaishunService { gameActivityService.handleGameSpendTask(userId, Math.abs(request.getCurrencyDiff())); // 累加用户获得的金币并发送抽奖券 - activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, request.getCurrencyDiff()); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, request.getCurrencyDiff(), MonthlyRechargeType.UNDEFINED); } } 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 9b40d299..84fb1763 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 @@ -19,6 +19,7 @@ import com.red.circle.framework.core.exception.ResponseException; import com.red.circle.framework.core.security.UserCredential; import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.game.HotGameUpdateRequest; import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; @@ -325,7 +326,7 @@ public class HotGameServiceImpl implements HotGameService { gameActivityService.handleGameSpendTask(userId, param.getCoin()); // 累加用户获得的金币并发送抽奖券 - activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(param.getCoin())); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(param.getCoin()), MonthlyRechargeType.UNDEFINED); } return new HotGameResponse() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java index 14adffc5..c49d309e 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/game/YomiGameServiceImpl.java @@ -8,6 +8,7 @@ import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum; import com.red.circle.framework.core.dto.ReqSysOrigin; import com.red.circle.framework.core.security.UserCredential; import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.activity.RankingDataUpdateCmd; import com.red.circle.other.app.dto.cmd.party3rd.*; @@ -178,7 +179,7 @@ public class YomiGameServiceImpl implements YomiGameService { gameActivityService.handleGameSpendTask(userId, changeValue.longValue()); // 累加用户获得的金币并发送抽奖券 - activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(changeValue.longValue())); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(userId, Math.abs(changeValue.longValue()), MonthlyRechargeType.UNDEFINED); } return new YomiBalanceCO(currentBalance); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/UserActivityRechargeDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/UserActivityRechargeDAO.java index 017715d6..f9abe0a2 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/UserActivityRechargeDAO.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/UserActivityRechargeDAO.java @@ -37,7 +37,7 @@ public interface UserActivityRechargeDAO extends BaseDAO { * @param activityId 活动ID * @return 排行榜列表 */ - IPage pageRechargeRank(Page page, @Param("activityId") Long activityId); + IPage pageRechargeRank(Page page, @Param("activityId") Long activityId, @Param("rechargeType") String rechargeType); /** * 查询用户在活动中的充值总额 diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/activity/UserActivityRechargeDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/activity/UserActivityRechargeDAO.xml index 2c2af9d8..a5da4796 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/activity/UserActivityRechargeDAO.xml +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/activity/UserActivityRechargeDAO.xml @@ -17,6 +17,9 @@ SUM(amount) AS totalAmount FROM user_activity_recharge WHERE activity_id = #{activityId} + + AND recharge_type = #{rechargeType} + GROUP BY user_id ORDER BY totalAmount DESC diff --git a/rc-service/rc-service-other/other-start/src/test/java/RedisTest.java b/rc-service/rc-service-other/other-start/src/test/java/RedisTest.java index 8f754f9c..bb0312e5 100644 --- a/rc-service/rc-service-other/other-start/src/test/java/RedisTest.java +++ b/rc-service/rc-service-other/other-start/src/test/java/RedisTest.java @@ -1,5 +1,6 @@ import com.red.circle.OtherServiceApplication; import com.red.circle.component.redis.service.RedisService; +import com.red.circle.order.inner.model.enums.MonthlyRechargeType; import com.red.circle.other.app.service.activity.ActivityRechargeTicketService; import org.junit.Test; import org.junit.runner.RunWith; @@ -51,7 +52,7 @@ public class RedisTest { @Test public void testRedis2(){ - activityRechargeTicketService.accumulatedRechargeAndAddTicket(1957345312961527809L, 80000L); + activityRechargeTicketService.accumulatedRechargeAndAddTicket(1957345312961527809L, 80000L, MonthlyRechargeType.UNDEFINED); }