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 f7c0879c..54567986 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 @@ -49,7 +49,7 @@ public class ActivityRechargeRankExe { if (CollectionUtils.isEmpty(rankPage.getRecords())) { result.setTopList(Collections.emptyList()); - result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId())); + result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId(), rechargeType)); return result; } @@ -83,14 +83,14 @@ public class ActivityRechargeRankExe { } result.setTopList(topList); - result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId())); + result.setCurrentUser(buildCurrentUserRank(cmd.getActivityId(), cmd.getReqUserId(), rechargeType)); return result; } - private UserRechargeRankCO buildCurrentUserRank(Long activityId, Long userId) { - BigDecimal totalAmount = userActivityRechargeDAO.getUserTotalAmount(userId, activityId); - Integer rank = userActivityRechargeDAO.getUserRank(activityId, userId); + private UserRechargeRankCO buildCurrentUserRank(Long activityId, Long userId, String rechargeType) { + BigDecimal totalAmount = userActivityRechargeDAO.getUserTotalAmount(userId, activityId, rechargeType); + Integer rank = userActivityRechargeDAO.getUserRank(activityId, userId, rechargeType); UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( userProfileGateway.getByUserId(userId) 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 3fff8a41..5d5eacea 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 @@ -59,7 +59,7 @@ public class ActivityRechargeTicketService { private void processTicketDistribution(Long userId) { 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) { return; } 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 f9abe0a2..4b4ad35e 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 @@ -46,7 +46,7 @@ public interface UserActivityRechargeDAO extends BaseDAO { * @param userId 用户ID * @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 { * @param userId 用户ID * @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); /** * 查询用户在活动中的首次充值日期 diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/activity/impl/UserActivityRechargeServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/activity/impl/UserActivityRechargeServiceImpl.java index 0042d274..c13878b0 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/activity/impl/UserActivityRechargeServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/activity/impl/UserActivityRechargeServiceImpl.java @@ -59,7 +59,7 @@ public class UserActivityRechargeServiceImpl implements UserActivityRechargeServ @Override public BigDecimal getUserTotalAmount(Long userId, Long activityId) { - return userActivityRechargeDAO.getUserTotalAmount(userId, activityId); + return userActivityRechargeDAO.getUserTotalAmount(userId, activityId, null); } @Override 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 a5da4796..2b558e6a 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 @@ -29,6 +29,9 @@ FROM user_activity_recharge WHERE activity_id = #{activityId} AND user_id = #{userId} + + AND recharge_type = #{rechargeType} +