用户 访客粉丝关注搜素进入房间 赋值财富等级字段

This commit is contained in:
tianfeng 2026-05-21 16:12:23 +08:00
parent eacce3cacf
commit 354f75401b
7 changed files with 80 additions and 15 deletions

View File

@ -113,6 +113,8 @@ public class RoomEnterCmdExe {
); );
ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, ownUserProfile); 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 = createAgoraToken(cmd);
String token = userAgoraTokenCacheService.getUserAgoraToken(cmd.getReqUserId(), cmd.getRoomId()); String token = userAgoraTokenCacheService.getUserAgoraToken(cmd.getReqUserId(), cmd.getRoomId());
if (Objects.isNull(token)) { if (Objects.isNull(token)) {

View File

@ -1,5 +1,6 @@
package com.red.circle.other.app.command.room.query; 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.common.room.RoomContributionCommon;
import com.red.circle.other.app.dto.clientobject.room.RoomContributionTopCO; import com.red.circle.other.app.dto.clientobject.room.RoomContributionTopCO;
import com.red.circle.other.app.dto.cmd.room.RoomContributionRankQryCmd; import com.red.circle.other.app.dto.cmd.room.RoomContributionRankQryCmd;
@ -20,8 +21,9 @@ public class RoomContributionTodayTopQryExe {
public List<RoomContributionTopCO> execute(RoomContributionRankQryCmd cmd) { public List<RoomContributionTopCO> execute(RoomContributionRankQryCmd cmd) {
SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin());
return roomContributionCommon.getRoomContributionTop(cmd.getDataType(), cmd.getRoomId(), return roomContributionCommon.getRoomContributionTop(cmd.getDataType(), cmd.getRoomId(),
cmd.getSize()); cmd.getSize(), sysOrigin);
} }

View File

@ -1,9 +1,11 @@
package com.red.circle.other.app.command.user.query; package com.red.circle.other.app.command.user.query;
import com.red.circle.common.business.core.AppBusinessUtils; 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.framework.core.asserts.ResponseAssert;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; 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.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.model.user.UserProfile;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.inner.asserts.user.UserErrorCode; import com.red.circle.other.inner.asserts.user.UserErrorCode;
@ -40,6 +42,13 @@ public class UserProfileUseSearchQryExe {
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile);
userProfileDTO.setIsFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userProfile.getId()))); userProfileDTO.setIsFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userProfile.getId())));
userProfileDTO.setIsSuperFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkSuperFreightAgent(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; return userProfileDTO;
} }

View File

@ -1,13 +1,16 @@
package com.red.circle.other.app.command.user.query; package com.red.circle.other.app.command.user.query;
import com.google.common.collect.Lists; 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.common.business.dto.cmd.app.AppFlowCmd;
import com.red.circle.tool.core.collection.CollectionUtils; 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.PropsUserAppConvertor;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; 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.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.model.user.UserProfile;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; 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.entity.user.user.UserSubscription;
import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService;
import java.util.List; import java.util.List;
@ -41,15 +44,25 @@ public class UserRelationFansQryExe {
return Lists.newArrayList(); return Lists.newArrayList();
} }
Map<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds( Set<Long> userIds = getUserIds(userFans);
getUserIds(userFans)); Map<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds(userIds);
SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin());
Map<Long, UserConsumptionLevel> consumptionLevelMap =
userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds);
return userFans.stream().map(userSubscription -> { return userFans.stream().map(userSubscription -> {
UserProfile userProfile = userProfileMap.get(userSubscription.getUserId()); 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() return new UserSupportRelationCO()
.setId(userSubscription.getId()) .setId(userSubscription.getId())
.setUserProfile( .setUserProfile(userProfileDTO)
userProfileAppConvertor.toUserProfileDTO(userProfile))
.setMutualRelations(userSubscription.getMutualRelations()) .setMutualRelations(userSubscription.getMutualRelations())
.setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps()));
}) })

View File

@ -1,13 +1,16 @@
package com.red.circle.other.app.command.user.query; package com.red.circle.other.app.command.user.query;
import com.google.common.collect.Lists; 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.common.business.dto.cmd.app.AppFlowCmd;
import com.red.circle.tool.core.collection.CollectionUtils; 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.PropsUserAppConvertor;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; 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.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.model.user.UserProfile;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; 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.entity.user.user.UserSubscription;
import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService;
@ -46,15 +49,26 @@ public class UserRelationFollowQryExe {
return Lists.newArrayList(); return Lists.newArrayList();
} }
Map<Long, UserProfile> userProfileMap = userProfileGateway Set<Long> userIds = getSubscribeUserId(userSubscriptions);
.mapByUserIds(getSubscribeUserId(userSubscriptions)); Map<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds(userIds);
SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin());
Map<Long, UserConsumptionLevel> consumptionLevelMap =
userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds);
return userSubscriptions.stream() return userSubscriptions.stream()
.map(userSubscription -> { .map(userSubscription -> {
UserProfile userProfile = userProfileMap.get(userSubscription.getSubscribeUserId()); 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() return new UserSupportRelationCO()
.setId(userSubscription.getId()) .setId(userSubscription.getId())
.setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) .setUserProfile(userProfileDTO)
.setMutualRelations(userSubscription.getMutualRelations()) .setMutualRelations(userSubscription.getMutualRelations())
.setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps()));
}) })

View File

@ -1,13 +1,16 @@
package com.red.circle.other.app.command.user.query; package com.red.circle.other.app.command.user.query;
import com.google.common.collect.Lists; 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.tool.core.collection.CollectionUtils;
import com.red.circle.other.app.convertor.user.PropsUserAppConvertor; import com.red.circle.other.app.convertor.user.PropsUserAppConvertor;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; 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.clientobject.user.relation.UserSupportRelationCO;
import com.red.circle.other.app.dto.cmd.user.relation.UserSupportRelationVisitorPageCmd; 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.model.user.UserProfile;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; 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.entity.user.user.UserInterview;
import com.red.circle.other.infra.database.rds.service.user.user.UserInterviewService; import com.red.circle.other.infra.database.rds.service.user.user.UserInterviewService;
import java.util.List; import java.util.List;
@ -39,15 +42,25 @@ public class UserSupportRelationVisitorQryExe {
if (CollectionUtils.isEmpty(userInterviews)) { if (CollectionUtils.isEmpty(userInterviews)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
Map<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds( Set<Long> userIds = getUserIds(userInterviews);
getUserIds(userInterviews)); Map<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds(userIds);
SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin());
Map<Long, UserConsumptionLevel> consumptionLevelMap =
userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds);
return userInterviews.stream().map(userInterview -> { return userInterviews.stream().map(userInterview -> {
UserProfile userProfile = userProfileMap.get(userInterview.getUserId()); 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() return new UserSupportRelationCO()
.setId(userInterview.getId()) .setId(userInterview.getId())
.setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) .setUserProfile(userProfileDTO)
.setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps())); .setUseProps(propsUserAppConvertor.toListUsePropsDTO(userProfile.getUseProps()));
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -1,17 +1,21 @@
package com.red.circle.other.app.common.room; package com.red.circle.other.app.common.room;
import com.google.common.collect.Lists; 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.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.clientobject.room.RoomContributionTopCO; 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.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.domain.model.user.UserProfile;
import com.red.circle.other.infra.database.mongo.entity.live.RoomContributionRankCount; 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.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.collection.CollectionUtils;
import com.red.circle.tool.core.num.NumUtils; import com.red.circle.tool.core.num.NumUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -30,7 +34,7 @@ public class RoomContributionCommon {
private final RoomContributionRankCountService roomContributionRankCountService; private final RoomContributionRankCountService roomContributionRankCountService;
public List<RoomContributionTopCO> getRoomContributionTop(String dateType, Long roomId, public List<RoomContributionTopCO> getRoomContributionTop(String dateType, Long roomId,
Integer size) { Integer size, SysOriginPlatformEnum sysOrigin) {
List<RoomContributionRankCount> countDailies = roomContributionRankCountService List<RoomContributionRankCount> countDailies = roomContributionRankCountService
.listTop(dateType, roomId, size); .listTop(dateType, roomId, size);
@ -39,16 +43,24 @@ public class RoomContributionCommon {
return Lists.newArrayList(); return Lists.newArrayList();
} }
Map<Long, UserProfile> baseInfoMap = userProfileGateway.mapByUserIds(countDailies.stream() Set<Long> userIds = countDailies.stream()
.map(RoomContributionRankCount::getUserId).collect(Collectors.toSet())); .map(RoomContributionRankCount::getUserId).collect(Collectors.toSet());
Map<Long, UserProfile> baseInfoMap = userProfileGateway.mapByUserIds(userIds);
Map<Long, UserConsumptionLevel> consumptionLevelMap =
userProfileGateway.getUserConsumptionLevel(sysOrigin, userIds);
return countDailies.stream().map(countDaily -> { return countDailies.stream().map(countDaily -> {
UserProfile userProfile = baseInfoMap.get(countDaily.getUserId()); UserProfile userProfile = baseInfoMap.get(countDaily.getUserId());
if (Objects.isNull(userProfile)) { if (Objects.isNull(userProfile)) {
return null; return null;
} }
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile);
UserConsumptionLevel consumptionLevel = consumptionLevelMap.get(countDaily.getUserId());
if (consumptionLevel != null) {
userProfileDTO.setWealthLevel(consumptionLevel.getWealthLevel());
}
return new RoomContributionTopCO() return new RoomContributionTopCO()
.setUserProfile(userProfileAppConvertor.toUserProfileDTO(userProfile)) .setUserProfile(userProfileDTO)
.setTotalFormat(NumUtils.formatLong(countDaily.getQuantity())) .setTotalFormat(NumUtils.formatLong(countDaily.getQuantity()))
.setTotal(countDaily.getQuantity()); .setTotal(countDaily.getQuantity());
}).filter(Objects::nonNull).toList(); }).filter(Objects::nonNull).toList();