diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/RoomEnterCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/RoomEnterCmdExe.java index 2fde45bc..b5b038a2 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/RoomEnterCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/RoomEnterCmdExe.java @@ -113,6 +113,8 @@ public class RoomEnterCmdExe { ); ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, ownUserProfile); + Optional.ofNullable(userProfileGateway.getUserConsumptionLevel(cmd.requireReqSysOriginEnum(), manager.getUserId())) + .ifPresent(level -> ownUserProfile.setWealthLevel(level.getWealthLevel())); //String token = createAgoraToken(cmd); String token = userAgoraTokenCacheService.getUserAgoraToken(cmd.getReqUserId(), cmd.getRoomId()); if (Objects.isNull(token)) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomContributionTodayTopQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomContributionTodayTopQryExe.java index 0a2743f7..79306fd8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomContributionTodayTopQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/RoomContributionTodayTopQryExe.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.command.room.query; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.other.app.common.room.RoomContributionCommon; import com.red.circle.other.app.dto.clientobject.room.RoomContributionTopCO; import com.red.circle.other.app.dto.cmd.room.RoomContributionRankQryCmd; @@ -20,8 +21,9 @@ public class RoomContributionTodayTopQryExe { public List execute(RoomContributionRankQryCmd cmd) { + SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin()); return roomContributionCommon.getRoomContributionTop(cmd.getDataType(), cmd.getRoomId(), - cmd.getSize()); + cmd.getSize(), sysOrigin); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserProfileUseSearchQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserProfileUseSearchQryExe.java index 06f26883..b9815c0f 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserProfileUseSearchQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserProfileUseSearchQryExe.java @@ -1,9 +1,11 @@ package com.red.circle.other.app.command.user.query; import com.red.circle.common.business.core.AppBusinessUtils; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.user.user.AccountQryCmd; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.inner.asserts.user.UserErrorCode; @@ -40,6 +42,13 @@ public class UserProfileUseSearchQryExe { UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); userProfileDTO.setIsFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userProfile.getId()))); userProfileDTO.setIsSuperFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkSuperFreightAgent(userProfile.getId()))); + + SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.requireReqSysOrigin()); + UserConsumptionLevel consumptionLevel = userProfileGateway.getUserConsumptionLevel(sysOrigin, userProfile.getId()); + if (consumptionLevel != null) { + userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel()); + } + return userProfileDTO; } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java index a1a22aff..5fe3f040 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFansQryExe.java @@ -1,13 +1,16 @@ package com.red.circle.other.app.command.user.query; import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.common.business.dto.cmd.app.AppFlowCmd; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.other.app.convertor.user.PropsUserAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.user.relation.UserSupportRelationCO; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.infra.database.rds.entity.user.user.UserSubscription; import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; import java.util.List; @@ -41,15 +44,25 @@ public class UserRelationFansQryExe { return Lists.newArrayList(); } - Map userProfileMap = userProfileGateway.mapByUserIds( - getUserIds(userFans)); + Set userIds = getUserIds(userFans); + Map userProfileMap = userProfileGateway.mapByUserIds(userIds); + + SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin()); + Map consumptionLevelMap = + userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds); return userFans.stream().map(userSubscription -> { UserProfile userProfile = userProfileMap.get(userSubscription.getUserId()); + UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); + + UserConsumptionLevel consumptionLevel = consumptionLevelMap.get(userSubscription.getUserId()); + if (consumptionLevel != null) { + userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel()); + } + return new UserSupportRelationCO() .setId(userSubscription.getId()) - .setUserProfile( - userProfileAppConvertor.toUserProfileDTO(userProfile)) + .setUserProfile(userProfileDTO) .setMutualRelations(userSubscription.getMutualRelations()) .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); }) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java index f076e6c1..5b836e24 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserRelationFollowQryExe.java @@ -1,13 +1,16 @@ package com.red.circle.other.app.command.user.query; import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.common.business.dto.cmd.app.AppFlowCmd; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.other.app.convertor.user.PropsUserAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.user.relation.UserSupportRelationCO; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.infra.database.rds.entity.user.user.UserSubscription; import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; @@ -46,15 +49,26 @@ public class UserRelationFollowQryExe { return Lists.newArrayList(); } - Map userProfileMap = userProfileGateway - .mapByUserIds(getSubscribeUserId(userSubscriptions)); + Set userIds = getSubscribeUserId(userSubscriptions); + Map userProfileMap = userProfileGateway.mapByUserIds(userIds); + + SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin()); + Map consumptionLevelMap = + userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds); return userSubscriptions.stream() .map(userSubscription -> { UserProfile userProfile = userProfileMap.get(userSubscription.getSubscribeUserId()); + UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); + + UserConsumptionLevel consumptionLevel = consumptionLevelMap.get(userSubscription.getSubscribeUserId()); + if (consumptionLevel != null) { + userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel()); + } + return new UserSupportRelationCO() .setId(userSubscription.getId()) - .setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) + .setUserProfile(userProfileDTO) .setMutualRelations(userSubscription.getMutualRelations()) .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); }) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserSupportRelationVisitorQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserSupportRelationVisitorQryExe.java index 1ac61b74..fb5a5b7c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserSupportRelationVisitorQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserSupportRelationVisitorQryExe.java @@ -1,13 +1,16 @@ package com.red.circle.other.app.command.user.query; import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.other.app.convertor.user.PropsUserAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.user.relation.UserSupportRelationCO; import com.red.circle.other.app.dto.cmd.user.relation.UserSupportRelationVisitorPageCmd; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.infra.database.rds.entity.user.user.UserInterview; import com.red.circle.other.infra.database.rds.service.user.user.UserInterviewService; import java.util.List; @@ -39,15 +42,25 @@ public class UserSupportRelationVisitorQryExe { if (CollectionUtils.isEmpty(userInterviews)) { return Lists.newArrayList(); } - Map userProfileMap = userProfileGateway.mapByUserIds( - getUserIds(userInterviews)); + Set userIds = getUserIds(userInterviews); + Map userProfileMap = userProfileGateway.mapByUserIds(userIds); + + SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin()); + Map consumptionLevelMap = + userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds); return userInterviews.stream().map(userInterview -> { UserProfile userProfile = userProfileMap.get(userInterview.getUserId()); + UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); + + UserConsumptionLevel consumptionLevel = consumptionLevelMap.get(userInterview.getUserId()); + if (consumptionLevel != null) { + userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel()); + } return new UserSupportRelationCO() .setId(userInterview.getId()) - .setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) + .setUserProfile(userProfileDTO) .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); }) .collect(Collectors.toList()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/RoomContributionCommon.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/RoomContributionCommon.java index 2015bafc..4397cab1 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/RoomContributionCommon.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/RoomContributionCommon.java @@ -1,17 +1,21 @@ package com.red.circle.other.app.common.room; import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.room.RoomContributionTopCO; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.mongo.entity.live.RoomContributionRankCount; import com.red.circle.other.infra.database.mongo.service.live.RoomContributionRankCountService; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.num.NumUtils; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -30,7 +34,7 @@ public class RoomContributionCommon { private final RoomContributionRankCountService roomContributionRankCountService; public List getRoomContributionTop(String dateType, Long roomId, - Integer size) { + Integer size, SysOriginPlatformEnum sysOrigin) { List countDailies = roomContributionRankCountService .listTop(dateType, roomId, size); @@ -39,16 +43,24 @@ public class RoomContributionCommon { return Lists.newArrayList(); } - Map baseInfoMap = userProfileGateway.mapByUserIds(countDailies.stream() - .map(RoomContributionRankCount::getUserId).collect(Collectors.toSet())); + Set userIds = countDailies.stream() + .map(RoomContributionRankCount::getUserId).collect(Collectors.toSet()); + Map baseInfoMap = userProfileGateway.mapByUserIds(userIds); + Map consumptionLevelMap = + userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds); return countDailies.stream().map(countDaily -> { UserProfile userProfile = baseInfoMap.get(countDaily.getUserId()); if (Objects.isNull(userProfile)) { return null; } + UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); + UserConsumptionLevel consumptionLevel = consumptionLevelMap.get(countDaily.getUserId()); + if (consumptionLevel != null) { + userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel()); + } return new RoomContributionTopCO() - .setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) + .setUserProfile(userProfileDTO) .setTotalFormat(NumUtils.formatLong(countDaily.getQuantity())) .setTotal(countDaily.getQuantity()); }).filter(Objects::nonNull).toList();