cpValue 实时展示处理
This commit is contained in:
parent
76f5cbdae6
commit
a054181a4f
@ -62,6 +62,8 @@ public class CpSimpleUserProfileCO implements Serializable {
|
||||
*/
|
||||
private String cpUserNickname;
|
||||
|
||||
private Long cpValId;
|
||||
|
||||
/**
|
||||
* 心动值
|
||||
*/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
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.dto.cmd.app.AppUserIdCmd;
|
||||
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.infra.database.mongo.entity.live.RoomProfileManager;
|
||||
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.other.inner.asserts.user.UserErrorCode;
|
||||
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.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -42,6 +50,7 @@ public class UserProfileUseQryExe {
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
private final RedisService redisService;
|
||||
private final UserSupportRelationService userRelationInterviewService;
|
||||
private final CpValueService cpValueService;
|
||||
|
||||
public UserProfileDTO execute(UserProfileQryCmd cmd) {
|
||||
UserProfile userProfile = getUserProfile(cmd);
|
||||
@ -87,6 +96,19 @@ public class UserProfileUseQryExe {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -367,6 +367,7 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
|
||||
.setCpAccount(cpUser.getAccount())
|
||||
.setCpUserAvatar(cpUser.getUserAvatar())
|
||||
.setCpUserNickname(cpUser.getUserNickname())
|
||||
.setCpValId(cpRelationship.getCpValId())
|
||||
.setCpValue(cpValue)
|
||||
.setCreateTime(cpRelationship.getCreateTime())
|
||||
.setDays(days)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user