首页排行榜是统计完成完成
This commit is contained in:
parent
d9024a0d23
commit
2cde5525b4
@ -37,7 +37,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public ActivityLeaderboardCO execute(AppExtCommand cmd) {
|
||||
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,50);
|
||||
List<RankQueenCount> days = getListRank(cmd, RankQueenType.CHARM_RANK_DAY,50);
|
||||
List<RankQueenCount> weeks = getListRank(cmd, RankQueenType.CHARM_RANK_WEEK,50);
|
||||
List<RankQueenCount> months = getListRank(cmd, RankQueenType.CHARM_RANK_MONTH,50);
|
||||
@ -45,6 +45,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
Set<Long> userIds = getUserIds(days);
|
||||
userIds.addAll(getUserIds(weeks));
|
||||
userIds.addAll(getUserIds(months));
|
||||
userIds.addAll(getUserIds(hours));
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
@ -53,6 +54,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toLeaderboardUserCO(hours, userProfileMap))
|
||||
.setDaily(toLeaderboardUserCO(days, userProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(months, userProfileMap))
|
||||
@ -60,7 +62,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
}
|
||||
|
||||
public ActivityLeaderboardCO executeApp(AppExtCommand cmd) {
|
||||
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,3);
|
||||
List<RankQueenCount> days = getListRank(cmd, RankQueenType.CHARM_RANK_DAY,3);
|
||||
List<RankQueenCount> weeks = getListRank(cmd, RankQueenType.CHARM_RANK_WEEK,3);
|
||||
List<RankQueenCount> months = getListRank(cmd, RankQueenType.CHARM_RANK_MONTH,3);
|
||||
@ -68,6 +70,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
Set<Long> userIds = getUserIds(days);
|
||||
userIds.addAll(getUserIds(weeks));
|
||||
userIds.addAll(getUserIds(months));
|
||||
userIds.addAll(getUserIds(hours));
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
@ -76,6 +79,7 @@ public class GiftsReceivedLeaderboardQryExe {
|
||||
);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toLeaderboardUserCO(hours, userProfileMap))
|
||||
.setDaily(toLeaderboardUserCO(days, userProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(months, userProfileMap))
|
||||
|
||||
@ -37,12 +37,12 @@ public class GiftsSendLeaderboardQryExe {
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public ActivityLeaderboardCO execute(AppExtCommand cmd) {
|
||||
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.WEALTH_RANK_HOUR,50);
|
||||
List<RankQueenCount> days = getListRank(cmd, RankQueenType.WEALTH_RANK_DAY,50);
|
||||
List<RankQueenCount> weeks = getListRank(cmd, RankQueenType.WEALTH_RANK_WEEK,50);
|
||||
List<RankQueenCount> months = getListRank(cmd, RankQueenType.WEALTH_RANK_MONTH,50);
|
||||
|
||||
Set<Long> userIds = getAllUserIds(days, weeks, months);
|
||||
Set<Long> userIds = getAllUserIds(days, weeks, months, hours);
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
@ -51,6 +51,7 @@ public class GiftsSendLeaderboardQryExe {
|
||||
);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toLeaderboardUserCO(hours, userProfileMap))
|
||||
.setDaily(toLeaderboardUserCO(days, userProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(months, userProfileMap));
|
||||
@ -84,6 +85,15 @@ public class GiftsSendLeaderboardQryExe {
|
||||
return userIds;
|
||||
}
|
||||
|
||||
private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks,
|
||||
List<RankQueenCount> months, List<RankQueenCount> hours) {
|
||||
Set<Long> userIds = getUserIds(days);
|
||||
userIds.addAll(getUserIds(weeks));
|
||||
userIds.addAll(getUserIds(months));
|
||||
userIds.addAll(getUserIds(hours));
|
||||
return userIds;
|
||||
}
|
||||
|
||||
private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list,
|
||||
Map<Long, UserProfileDTO> userProfileMap) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
|
||||
@ -37,12 +37,12 @@ public class RechargeLeaderboardQryExe {
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public ActivityLeaderboardCO execute(AppExtCommand cmd) {
|
||||
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.RECHARGE_RANK_HOUR,50);
|
||||
List<RankQueenCount> days = getListRank(cmd, RankQueenType.RECHARGE_RANK_DAY,50);
|
||||
List<RankQueenCount> weeks = getListRank(cmd, RankQueenType.RECHARGE_RANK_WEEK,50);
|
||||
List<RankQueenCount> months = getListRank(cmd, RankQueenType.RECHARGE_RANK_MONTH,50);
|
||||
|
||||
Set<Long> userIds = getAllUserIds(days, weeks, months);
|
||||
Set<Long> userIds = getAllUserIds(days, weeks, months, hours);
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
@ -51,6 +51,7 @@ public class RechargeLeaderboardQryExe {
|
||||
);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toActivityLeaderboardUserCO(hours, userProfileMap))
|
||||
.setDaily(toActivityLeaderboardUserCO(days, userProfileMap))
|
||||
.setWeekly(toActivityLeaderboardUserCO(weeks, userProfileMap))
|
||||
.setMonthly(toActivityLeaderboardUserCO(months, userProfileMap));
|
||||
@ -87,6 +88,14 @@ public class RechargeLeaderboardQryExe {
|
||||
return userIds;
|
||||
}
|
||||
|
||||
private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks,
|
||||
List<RankQueenCount> months, List<RankQueenCount> hours) {
|
||||
Set<Long> userIds = getUserIds(days);
|
||||
userIds.addAll(getUserIds(weeks));
|
||||
userIds.addAll(getUserIds(months));
|
||||
return userIds;
|
||||
}
|
||||
|
||||
private List<LeaderboardUserCO> toActivityLeaderboardUserCO(List<RankQueenCount> list,
|
||||
Map<Long, UserProfileDTO> userProfileMap) {
|
||||
|
||||
|
||||
@ -35,18 +35,19 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
|
||||
public ActivityLeaderboardCO execute(AppExtCommand cmd) {
|
||||
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.ROOM_RANK_HOUR,50);
|
||||
List<RankQueenCount> days = getListRank(cmd, RankQueenType.ROOM_RANK_DAY,50);
|
||||
List<RankQueenCount> weeks = getListRank(cmd, RankQueenType.ROOM_RANK_WEEK,50);
|
||||
List<RankQueenCount> months = getListRank(cmd, RankQueenType.ROOM_RANK_MONTH,50);
|
||||
|
||||
Set<Long> roomIds = getAllUserIds(days, weeks, months);
|
||||
Set<Long> roomIds = getAllUserIds(days, weeks, months, hours);
|
||||
if (CollectionUtils.isEmpty(roomIds)) {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
Map<Long, RoomProfile> roomProfileMap = roomProfileManagerService.mapProfileByRoomIds(roomIds);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toLeaderboardUserCO(hours, roomProfileMap))
|
||||
.setDaily(toLeaderboardUserCO(days, roomProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, roomProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(months, roomProfileMap));
|
||||
@ -78,6 +79,15 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
return roomIds;
|
||||
}
|
||||
|
||||
private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks,
|
||||
List<RankQueenCount> months, List<RankQueenCount> hours) {
|
||||
Set<Long> roomIds = getRoomIds(days);
|
||||
roomIds.addAll(getRoomIds(weeks));
|
||||
roomIds.addAll(getRoomIds(months));
|
||||
roomIds.addAll(getRoomIds(hours));
|
||||
return roomIds;
|
||||
}
|
||||
|
||||
private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list,
|
||||
Map<Long, RoomProfile> roomProfileMap) {
|
||||
|
||||
|
||||
@ -24,6 +24,11 @@ public class ActivityLeaderboardCO extends ClientObject {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 每日.
|
||||
*/
|
||||
private List<LeaderboardUserCO> hourly;
|
||||
|
||||
/**
|
||||
* 每日.
|
||||
*/
|
||||
@ -42,6 +47,7 @@ public class ActivityLeaderboardCO extends ClientObject {
|
||||
|
||||
public static ActivityLeaderboardCO empty() {
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(CollectionUtils.newArrayList())
|
||||
.setDaily(CollectionUtils.newArrayList())
|
||||
.setWeekly(CollectionUtils.newArrayList())
|
||||
.setMonthly(CollectionUtils.newArrayList());
|
||||
|
||||
@ -7,6 +7,27 @@ package com.red.circle.other.infra.database.mongo.entity.activity;
|
||||
*/
|
||||
public enum RankQueenType {
|
||||
|
||||
|
||||
/**
|
||||
* 魅力-时.
|
||||
*/
|
||||
CHARM_RANK_HOUR(2),
|
||||
|
||||
/**
|
||||
* 财富-时.
|
||||
*/
|
||||
WEALTH_RANK_HOUR(2),
|
||||
|
||||
/**
|
||||
* 房间-时.
|
||||
*/
|
||||
ROOM_RANK_HOUR(2),
|
||||
|
||||
/**
|
||||
* 充值-时.
|
||||
*/
|
||||
RECHARGE_RANK_HOUR(2),
|
||||
|
||||
/**
|
||||
* 魅力-天.
|
||||
*/
|
||||
|
||||
@ -17,15 +17,15 @@ public class AppRankCountServiceImpl implements AppRankCountService {
|
||||
|
||||
@Override
|
||||
public void incrRechargeQuantity(String sysOrigin, Long userId, Long quantity) {
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_HOUR, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_DAY, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_WEEK,
|
||||
quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_MONTH,
|
||||
quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_WEEK, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_MONTH, quantity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrRechargeQuantity(String sysOrigin, Long userId, Long quantity) {
|
||||
rankCountService.decrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_HOUR, quantity);
|
||||
rankCountService.decrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_DAY, quantity);
|
||||
rankCountService.decrRankQuantity(sysOrigin, userId, RankQueenType.RECHARGE_RANK_WEEK,
|
||||
quantity);
|
||||
@ -35,6 +35,7 @@ public class AppRankCountServiceImpl implements AppRankCountService {
|
||||
|
||||
@Override
|
||||
public void incrCharmQuantity(String sysOrigin, Long userId, Long quantity) {
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.CHARM_RANK_HOUR, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.CHARM_RANK_DAY, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.CHARM_RANK_WEEK, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.CHARM_RANK_MONTH, quantity);
|
||||
@ -42,6 +43,7 @@ public class AppRankCountServiceImpl implements AppRankCountService {
|
||||
|
||||
@Override
|
||||
public void incrWealthQuantity(String sysOrigin, Long userId, Long quantity) {
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.WEALTH_RANK_HOUR, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.WEALTH_RANK_DAY, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.WEALTH_RANK_WEEK, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, userId, RankQueenType.WEALTH_RANK_MONTH, quantity);
|
||||
@ -49,6 +51,7 @@ public class AppRankCountServiceImpl implements AppRankCountService {
|
||||
|
||||
@Override
|
||||
public void incrRoomWealthQuantity(String sysOrigin, Long roomId, Long quantity) {
|
||||
rankCountService.incrRankQuantity(sysOrigin, roomId, RankQueenType.ROOM_RANK_HOUR, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, roomId, RankQueenType.ROOM_RANK_DAY, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, roomId, RankQueenType.ROOM_RANK_WEEK, quantity);
|
||||
rankCountService.incrRankQuantity(sysOrigin, roomId, RankQueenType.ROOM_RANK_MONTH, quantity);
|
||||
|
||||
@ -145,6 +145,9 @@ public class RankCountServiceImpl implements RankCountService {
|
||||
}
|
||||
|
||||
private String getDateStr(RankQueenType type) {
|
||||
if (Objects.equals(type.getDay(), RankQueenType.RECHARGE_RANK_HOUR.getDay())) {
|
||||
return getTodayHour();
|
||||
}
|
||||
if (Objects.equals(type.getDay(), RankQueenType.RECHARGE_RANK_DAY.getDay())) {
|
||||
return getTodayDate();
|
||||
}
|
||||
@ -170,4 +173,8 @@ public class RankCountServiceImpl implements RankCountService {
|
||||
return ZonedDateTimeAsiaRiyadhUtils.nowDateToInt().toString();
|
||||
}
|
||||
|
||||
private String getTodayHour() {
|
||||
return ZonedDateTimeAsiaRiyadhUtils.nowFormat("yyyyMMddHH");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.tool.crypto.SecurityUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
@ -14,5 +15,10 @@ public class ApiTest {
|
||||
System.out.println(SecurityUtils.md5("1957345312961527809"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
System.out.println(ZonedDateTimeAsiaRiyadhUtils.nowFormat("yyyyMMddHH"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user