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

This commit is contained in:
tianfeng 2026-02-11 16:59:49 +08:00
parent ef245908f4
commit 833ff1c588
5 changed files with 18 additions and 9 deletions

View File

@ -49,7 +49,7 @@ public class ActivityRechargeRankExe {
if (CollectionUtils.isEmpty(rankPage.getRecords())) { if (CollectionUtils.isEmpty(rankPage.getRecords())) {
result.setTopList(Collections.emptyList()); result.setTopList(Collections.emptyList());
result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId())); result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId(), rechargeType));
return result; return result;
} }
@ -83,14 +83,14 @@ public class ActivityRechargeRankExe {
} }
result.setTopList(topList); result.setTopList(topList);
result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId())); result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId(), rechargeType));
return result; return result;
} }
private UserRechargeRankCO buildCurrentUserRank(Long activityId, Long userId) { private UserRechargeRankCO buildCurrentUserRank(Long activityId, Long userId, String rechargeType) {
BigDecimal totalAmount = userActivityRechargeDAO.getUserTotalAmount(userId, activityId); BigDecimal totalAmount = userActivityRechargeDAO.getUserTotalAmount(userId, activityId, rechargeType);
Integer rank = userActivityRechargeDAO.getUserRank(activityId, userId); Integer rank = userActivityRechargeDAO.getUserRank(activityId, userId, rechargeType);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(userId) userProfileGateway.getByUserId(userId)

View File

@ -59,7 +59,7 @@ public class ActivityRechargeTicketService {
private void processTicketDistribution(Long userId) { private void processTicketDistribution(Long userId) {
String thresholdKey = String.format("lucky:draw:threshold:%s:%s", userId, FIXED_ACTIVITY_ID); String thresholdKey = String.format("lucky:draw:threshold:%s:%s", userId, FIXED_ACTIVITY_ID);
BigDecimal totalWinCoins = userActivityRechargeDAO.getUserTotalAmount(userId, FIXED_ACTIVITY_ID); BigDecimal totalWinCoins = userActivityRechargeDAO.getUserTotalAmount(userId, FIXED_ACTIVITY_ID, null);
if (totalWinCoins == null || totalWinCoins.longValue() == 0) { if (totalWinCoins == null || totalWinCoins.longValue() == 0) {
return; return;
} }

View File

@ -46,7 +46,7 @@ public interface UserActivityRechargeDAO extends BaseDAO<UserActivityRecharge> {
* @param userId 用户ID * @param userId 用户ID
* @return 充值总额 * @return 充值总额
*/ */
BigDecimal getUserTotalAmount(@Param("userId") Long userId, @Param("activityId") Long activityId); BigDecimal getUserTotalAmount(@Param("userId") Long userId, @Param("activityId") Long activityId, @Param("rechargeType") String rechargeType);
/** /**
* 查询用户在活动中的排名 * 查询用户在活动中的排名
@ -55,7 +55,7 @@ public interface UserActivityRechargeDAO extends BaseDAO<UserActivityRecharge> {
* @param userId 用户ID * @param userId 用户ID
* @return 排名从1开始 * @return 排名从1开始
*/ */
Integer getUserRank(@Param("activityId") Long activityId, @Param("userId") Long userId); Integer getUserRank(@Param("activityId") Long activityId, @Param("userId") Long userId, @Param("rechargeType") String rechargeType);
/** /**
* 查询用户在活动中的首次充值日期 * 查询用户在活动中的首次充值日期

View File

@ -59,7 +59,7 @@ public class UserActivityRechargeServiceImpl implements UserActivityRechargeServ
@Override @Override
public BigDecimal getUserTotalAmount(Long userId, Long activityId) { public BigDecimal getUserTotalAmount(Long userId, Long activityId) {
return userActivityRechargeDAO.getUserTotalAmount(userId, activityId); return userActivityRechargeDAO.getUserTotalAmount(userId, activityId, null);
} }
@Override @Override

View File

@ -29,6 +29,9 @@
FROM user_activity_recharge FROM user_activity_recharge
WHERE activity_id = #{activityId} WHERE activity_id = #{activityId}
AND user_id = #{userId} AND user_id = #{userId}
<if test="rechargeType != null and rechargeType != ''">
AND recharge_type = #{rechargeType}
</if>
</select> </select>
<select id="getUserRank" resultType="java.lang.Integer"> <select id="getUserRank" resultType="java.lang.Integer">
@ -37,6 +40,9 @@
SELECT user_id, SUM(amount) AS total_amount SELECT user_id, SUM(amount) AS total_amount
FROM user_activity_recharge FROM user_activity_recharge
WHERE activity_id = #{activityId} WHERE activity_id = #{activityId}
<if test="rechargeType != null and rechargeType != ''">
AND recharge_type = #{rechargeType}
</if>
GROUP BY user_id GROUP BY user_id
) AS ranks ) AS ranks
WHERE total_amount > ( WHERE total_amount > (
@ -44,6 +50,9 @@
FROM user_activity_recharge FROM user_activity_recharge
WHERE activity_id = #{activityId} WHERE activity_id = #{activityId}
AND user_id = #{userId} AND user_id = #{userId}
<if test="rechargeType != null and rechargeType != ''">
AND recharge_type = #{rechargeType}
</if>
) )
</select> </select>