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

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);
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)) {

View File

@ -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<RoomContributionTopCO> execute(RoomContributionRankQryCmd cmd) {
SysOriginPlatformEnum sysOrigin = SysOriginPlatformEnum.toEnum(cmd.getReqSysOrigin().getOrigin());
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;
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;
}

View File

@ -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<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds(
getUserIds(userFans));
Set<Long> userIds = 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 -> {
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()));
})

View File

@ -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<Long, UserProfile> userProfileMap = userProfileGateway
.mapByUserIds(getSubscribeUserId(userSubscriptions));
Set<Long> userIds = 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()
.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()));
})

View File

@ -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<Long, UserProfile> userProfileMap = userProfileGateway.mapByUserIds(
getUserIds(userInterviews));
Set<Long> userIds = 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 -> {
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());

View File

@ -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<RoomContributionTopCO> getRoomContributionTop(String dateType, Long roomId,
Integer size) {
Integer size, SysOriginPlatformEnum sysOrigin) {
List<RoomContributionRankCount> countDailies = roomContributionRankCountService
.listTop(dateType, roomId, size);
@ -39,16 +43,24 @@ public class RoomContributionCommon {
return Lists.newArrayList();
}
Map<Long, UserProfile> baseInfoMap = userProfileGateway.mapByUserIds(countDailies.stream()
.map(RoomContributionRankCount::getUserId).collect(Collectors.toSet()));
Set<Long> userIds = countDailies.stream()
.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 -> {
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();