春节游戏和礼物排行榜我的排名类型处理
This commit is contained in:
parent
ef245908f4
commit
833ff1c588
@ -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)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public interface UserActivityRechargeDAO extends BaseDAO<UserActivityRecharge> {
|
||||
* @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<UserActivityRecharge> {
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 查询用户在活动中的首次充值日期
|
||||
|
||||
@ -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
|
||||
|
||||
@ -29,6 +29,9 @@
|
||||
FROM user_activity_recharge
|
||||
WHERE activity_id = #{activityId}
|
||||
AND user_id = #{userId}
|
||||
<if test="rechargeType != null and rechargeType != ''">
|
||||
AND recharge_type = #{rechargeType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUserRank" resultType="java.lang.Integer">
|
||||
@ -37,6 +40,9 @@
|
||||
SELECT user_id, SUM(amount) AS total_amount
|
||||
FROM user_activity_recharge
|
||||
WHERE activity_id = #{activityId}
|
||||
<if test="rechargeType != null and rechargeType != ''">
|
||||
AND recharge_type = #{rechargeType}
|
||||
</if>
|
||||
GROUP BY user_id
|
||||
) AS ranks
|
||||
WHERE total_amount > (
|
||||
@ -44,6 +50,9 @@
|
||||
FROM user_activity_recharge
|
||||
WHERE activity_id = #{activityId}
|
||||
AND user_id = #{userId}
|
||||
<if test="rechargeType != null and rechargeType != ''">
|
||||
AND recharge_type = #{rechargeType}
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user