春节游戏和礼物排行榜类型处理

This commit is contained in:
tianfeng 2026-02-11 15:30:15 +08:00
parent 6128d3c607
commit ef245908f4
11 changed files with 29 additions and 10 deletions

View File

@ -79,6 +79,11 @@ public enum MonthlyRechargeType {
*/
SYSTEM_BACKEND_SEND,
/**
* 幸运礼物获胜
*/
LUCKY_WIN,
/**
* 未定义.
*/

View File

@ -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);
}

View File

@ -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<ActivityRechargeRankDTO> page = new Page<>(cmd.getPageNo(), cmd.getPageSize());
IPage<ActivityRechargeRankDTO> rankPage = userActivityRechargeDAO.pageRechargeRank(page, cmd.getActivityId());
String rechargeType = null;
if (FIXED_ACTIVITY_ID.equals(cmd.getActivityId())) {
rechargeType = MonthlyRechargeType.LUCKY_WIN.name();
}
IPage<ActivityRechargeRankDTO> rankPage = userActivityRechargeDAO.pageRechargeRank(page, cmd.getActivityId(), rechargeType);
ActivityRechargeRankCO result = new ActivityRechargeRankCO();

View File

@ -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

View File

@ -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)
);

View File

@ -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);
}
}

View File

@ -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<HotGameCoin>()

View File

@ -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);

View File

@ -37,7 +37,7 @@ public interface UserActivityRechargeDAO extends BaseDAO<UserActivityRecharge> {
* @param activityId 活动ID
* @return 排行榜列表
*/
IPage<ActivityRechargeRankDTO> pageRechargeRank(Page<ActivityRechargeRankDTO> page, @Param("activityId") Long activityId);
IPage<ActivityRechargeRankDTO> pageRechargeRank(Page<ActivityRechargeRankDTO> page, @Param("activityId") Long activityId, @Param("rechargeType") String rechargeType);
/**
* 查询用户在活动中的充值总额

View File

@ -17,6 +17,9 @@
SUM(amount) AS totalAmount
FROM user_activity_recharge
WHERE activity_id = #{activityId}
<if test="rechargeType != null and rechargeType != ''">
AND recharge_type = #{rechargeType}
</if>
GROUP BY user_id
ORDER BY totalAmount DESC
</select>

View File

@ -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);
}