cpValue 实时展示处理

This commit is contained in:
tianfeng 2025-12-11 21:21:36 +08:00
parent 76f5cbdae6
commit a054181a4f
3 changed files with 25 additions and 0 deletions

View File

@ -62,6 +62,8 @@ public class CpSimpleUserProfileCO implements Serializable {
*/ */
private String cpUserNickname; private String cpUserNickname;
private Long cpValId;
/** /**
* 心动值 * 心动值
*/ */

View File

@ -1,5 +1,6 @@
package com.red.circle.other.app.command.user.query; package com.red.circle.other.app.command.user.query;
import cn.hutool.core.collection.CollectionUtil;
import com.red.circle.common.business.core.AppBusinessUtils; import com.red.circle.common.business.core.AppBusinessUtils;
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.component.redis.service.RedisService; import com.red.circle.component.redis.service.RedisService;
@ -15,12 +16,19 @@ import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
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.RoomProfileManager; import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.rds.service.user.user.CpValueService;
import com.red.circle.other.inner.model.dto.user.CpSimpleUserProfileCO;
import com.red.circle.tool.core.text.StringUtils; import com.red.circle.tool.core.text.StringUtils;
import com.red.circle.other.inner.asserts.user.UserErrorCode; import com.red.circle.other.inner.asserts.user.UserErrorCode;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -42,6 +50,7 @@ public class UserProfileUseQryExe {
private final RoomProfileManagerService roomProfileManagerService; private final RoomProfileManagerService roomProfileManagerService;
private final RedisService redisService; private final RedisService redisService;
private final UserSupportRelationService userRelationInterviewService; private final UserSupportRelationService userRelationInterviewService;
private final CpValueService cpValueService;
public UserProfileDTO execute(UserProfileQryCmd cmd) { public UserProfileDTO execute(UserProfileQryCmd cmd) {
UserProfile userProfile = getUserProfile(cmd); UserProfile userProfile = getUserProfile(cmd);
@ -87,6 +96,19 @@ public class UserProfileUseQryExe {
userRelationInterviewService.addVisitor(userIdCmd); userRelationInterviewService.addVisitor(userIdCmd);
} }
// 重新赋值cpValue
if (CollectionUtil.isNotEmpty(userProfileDTO.getCpList())) {
Set<Long> cpValIdSet = userProfileDTO.getCpList().stream().map(CpSimpleUserProfileCO::getCpValId).collect(Collectors.toSet());
Map<Long, BigDecimal> mapCpVal = cpValueService.mapCpVal(cpValIdSet);
userProfileDTO.getCpList().forEach(cp -> {
BigDecimal cpValue = mapCpVal.get(cp.getCpValId());
if (Objects.nonNull(cpValue)) {
cp.setCpValue(cpValue);
}
});
}
return userProfileDTO; return userProfileDTO;
} }

View File

@ -367,6 +367,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
.setCpAccount(cpUser.getAccount()) .setCpAccount(cpUser.getAccount())
.setCpUserAvatar(cpUser.getUserAvatar()) .setCpUserAvatar(cpUser.getUserAvatar())
.setCpUserNickname(cpUser.getUserNickname()) .setCpUserNickname(cpUser.getUserNickname())
.setCpValId(cpRelationship.getCpValId())
.setCpValue(cpValue) .setCpValue(cpValue)
.setCreateTime(cpRelationship.getCreateTime()) .setCreateTime(cpRelationship.getCreateTime())
.setDays(days) .setDays(days)