diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsReceivedLeaderboardQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsReceivedLeaderboardQryExe.java index c7936ae8..f7908744 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsReceivedLeaderboardQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsReceivedLeaderboardQryExe.java @@ -37,7 +37,7 @@ public class GiftsReceivedLeaderboardQryExe { private final UserProfileAppConvertor userProfileAppConvertor; public ActivityLeaderboardCO execute(AppExtCommand cmd) { - + List hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,50); List days = getListRank(cmd, RankQueenType.CHARM_RANK_DAY,50); List weeks = getListRank(cmd, RankQueenType.CHARM_RANK_WEEK,50); List months = getListRank(cmd, RankQueenType.CHARM_RANK_MONTH,50); @@ -45,6 +45,7 @@ public class GiftsReceivedLeaderboardQryExe { Set 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 hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,3); List days = getListRank(cmd, RankQueenType.CHARM_RANK_DAY,3); List weeks = getListRank(cmd, RankQueenType.CHARM_RANK_WEEK,3); List months = getListRank(cmd, RankQueenType.CHARM_RANK_MONTH,3); @@ -68,6 +70,7 @@ public class GiftsReceivedLeaderboardQryExe { Set 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)) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsSendLeaderboardQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsSendLeaderboardQryExe.java index 4926f918..4d85a68f 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsSendLeaderboardQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/GiftsSendLeaderboardQryExe.java @@ -37,12 +37,12 @@ public class GiftsSendLeaderboardQryExe { private final UserProfileAppConvertor userProfileAppConvertor; public ActivityLeaderboardCO execute(AppExtCommand cmd) { - + List hours = getListRank(cmd, RankQueenType.WEALTH_RANK_HOUR,50); List days = getListRank(cmd, RankQueenType.WEALTH_RANK_DAY,50); List weeks = getListRank(cmd, RankQueenType.WEALTH_RANK_WEEK,50); List months = getListRank(cmd, RankQueenType.WEALTH_RANK_MONTH,50); - Set userIds = getAllUserIds(days, weeks, months); + Set 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 getAllUserIds(List days, List weeks, + List months, List hours) { + Set userIds = getUserIds(days); + userIds.addAll(getUserIds(weeks)); + userIds.addAll(getUserIds(months)); + userIds.addAll(getUserIds(hours)); + return userIds; + } + private List toLeaderboardUserCO(List list, Map userProfileMap) { if (CollectionUtils.isEmpty(list)) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RechargeLeaderboardQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RechargeLeaderboardQryExe.java index 45163ec7..272fdec3 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RechargeLeaderboardQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RechargeLeaderboardQryExe.java @@ -37,12 +37,12 @@ public class RechargeLeaderboardQryExe { private final UserProfileAppConvertor userProfileAppConvertor; public ActivityLeaderboardCO execute(AppExtCommand cmd) { - + List hours = getListRank(cmd, RankQueenType.RECHARGE_RANK_HOUR,50); List days = getListRank(cmd, RankQueenType.RECHARGE_RANK_DAY,50); List weeks = getListRank(cmd, RankQueenType.RECHARGE_RANK_WEEK,50); List months = getListRank(cmd, RankQueenType.RECHARGE_RANK_MONTH,50); - Set userIds = getAllUserIds(days, weeks, months); + Set 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 getAllUserIds(List days, List weeks, + List months, List hours) { + Set userIds = getUserIds(days); + userIds.addAll(getUserIds(weeks)); + userIds.addAll(getUserIds(months)); + return userIds; + } + private List toActivityLeaderboardUserCO(List list, Map userProfileMap) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java index 02147cac..b13c9df0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java @@ -35,18 +35,19 @@ public class RoomGiftsLeaderboardQryExe { private final RoomProfileManagerService roomProfileManagerService; public ActivityLeaderboardCO execute(AppExtCommand cmd) { - + List hours = getListRank(cmd, RankQueenType.ROOM_RANK_HOUR,50); List days = getListRank(cmd, RankQueenType.ROOM_RANK_DAY,50); List weeks = getListRank(cmd, RankQueenType.ROOM_RANK_WEEK,50); List months = getListRank(cmd, RankQueenType.ROOM_RANK_MONTH,50); - Set roomIds = getAllUserIds(days, weeks, months); + Set roomIds = getAllUserIds(days, weeks, months, hours); if (CollectionUtils.isEmpty(roomIds)) { return ActivityLeaderboardCO.empty(); } Map 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 getAllUserIds(List days, List weeks, + List months, List hours) { + Set roomIds = getRoomIds(days); + roomIds.addAll(getRoomIds(weeks)); + roomIds.addAll(getRoomIds(months)); + roomIds.addAll(getRoomIds(hours)); + return roomIds; + } + private List toLeaderboardUserCO(List list, Map roomProfileMap) { diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/ActivityLeaderboardCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/ActivityLeaderboardCO.java index 55831411..c199b6d9 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/ActivityLeaderboardCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/ActivityLeaderboardCO.java @@ -24,6 +24,11 @@ public class ActivityLeaderboardCO extends ClientObject { @Serial private static final long serialVersionUID = 1L; + /** + * 每日. + */ + private List 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()); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/activity/RankQueenType.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/activity/RankQueenType.java index 8067eb59..6f1888fe 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/activity/RankQueenType.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/activity/RankQueenType.java @@ -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), + /** * 魅力-天. */ diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/AppRankCountServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/AppRankCountServiceImpl.java index 93491cd8..1f405b9d 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/AppRankCountServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/AppRankCountServiceImpl.java @@ -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); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/RankCountServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/RankCountServiceImpl.java index 91959b41..50a0bb55 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/RankCountServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/activity/impl/RankCountServiceImpl.java @@ -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"); + } + } diff --git a/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java b/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java index 8a3cd191..89f2386e 100644 --- a/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java +++ b/rc-service/rc-service-other/other-start/src/test/java/ApiTest.java @@ -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")); + } + }