wallet 修复

(cherry picked from commit 7812d1bad85570970fcb6938134d8132166334b5)

后台用户金币流水查询 去除冗余字段

(cherry picked from commit 9451f77e233c4ca0e3f15d823b164a4031df8b10)
This commit is contained in:
tianfeng 2026-06-01 15:51:49 +08:00
parent f419905dc2
commit 7a136ed804
8 changed files with 229 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import com.red.circle.other.inner.model.cmd.user.UserBaseInfoCmd;
import com.red.circle.other.inner.model.cmd.user.UserProfileListQryCmd;
import com.red.circle.other.inner.model.cmd.user.UserRemoveUsePropsCmd;
import com.red.circle.other.inner.model.cmd.user.UserSwitchUsePropsCmd;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRegisterInfoDTO;
@ -236,4 +237,10 @@ public interface UserProfileClientApi {
*/
@GetMapping("/restoreAuth")
ResultResponse<Void> restoreAuthDelByUserId(@RequestParam("userId") Long userId);
/**
* 获取用户资料集合简化版不含 cpList/backgroundPhotos/personalPhotos/useProps/badge/honor/firstRecharge.
*/
@PostMapping("/mapByUserIds/simple")
ResultResponse<Map<Long, SimpleUserProfileDTO>> mapByUserIdsSimple(@RequestBody Set<Long> userIds);
}

View File

@ -0,0 +1,185 @@
package com.red.circle.other.inner.model.dto.user;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.common.business.enums.AccountStatusEnum;
import com.red.circle.common.business.enums.ConsoleAccountStatusEnum;
import com.red.circle.tool.core.date.TimestampUtils;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;
import lombok.Data;
/**
* 用户资料简化版不含 cpList/backgroundPhotos/personalPhotos/useProps/badge/honor/firstRecharge.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class SimpleUserProfileDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private String account;
private String userAvatar;
private String userNickname;
private Integer userSex;
private Integer age;
private String accountStatus;
private Timestamp freezingTime;
private String isUpdateCountry;
@JsonSerialize(using = ToStringSerializer.class)
private Long countryId;
private String countryName;
private String countryCode;
private String autograph;
private String hobby;
private Boolean isCpRelation;
@JsonSerialize(using = ToStringSerializer.class)
private Long familyId;
private String inRoomId;
private String roomIcon;
private String regionCode;
private Integer wealthLevel;
private Integer charmLevel;
private String originSys;
private String sysOriginChild;
private Boolean del;
private Timestamp createTime;
private Integer bornYear;
private Integer bornMonth;
private Integer bornDay;
private OwnSpecialIdDTO ownSpecialId;
private Boolean sameRegion;
private Boolean isFreightAgent;
private Boolean isSuperFreightAgent;
private BigDecimal firstRechargeAmount;
public void setCountryCode(String countryCode) {
if (Objects.nonNull(countryCode) && Objects.equals(countryCode, "IA")) {
this.countryCode = "ID";
} else if (Objects.nonNull(countryCode) && Objects.equals(countryCode, "EY")) {
this.countryCode = "EG";
} else if (Objects.nonNull(countryCode) && Objects.equals(countryCode, "AB")) {
this.countryCode = "AE";
} else if (Objects.nonNull(countryCode) && Objects.equals(countryCode, "MB")) {
this.countryCode = "MA";
} else if (Objects.nonNull(countryCode) && Objects.equals(countryCode, "SP")) {
this.countryCode = "SA";
} else {
this.countryCode = countryCode;
}
}
@JsonSerialize(using = ToStringSerializer.class)
public Long getFreezingExpiredInterval() {
return TimestampUtils.expiredInterval(freezingTime);
}
public boolean checkAccountAvailable() {
return !checkAccountArchive() && !checkAccountFreeze();
}
public boolean checkAccountArchive() {
return AccountStatusEnum.isArchive(this.accountStatus);
}
public boolean checkAccountFreeze() {
return AccountStatusEnum.isFreeze(this.freezingTime);
}
public AccountStatusEnum getAccountStatus() {
if (this.checkAccountAvailable()) {
return AccountStatusEnum.NORMAL;
}
if (Objects.equals(AccountStatusEnum.ARCHIVE.name(), this.accountStatus) && !this.checkAccountFreeze()) {
return AccountStatusEnum.NORMAL;
}
if (this.checkAccountFreeze()) {
return AccountStatusEnum.FREEZE;
}
return AccountStatusEnum.valueOf(this.accountStatus);
}
public String getAccountStatusName() {
if (Objects.nonNull(this.freezingTime) && this.freezingTime.after(TimestampUtils.now())) {
return ConsoleAccountStatusEnum.FREEZE.getDesc();
}
if (Objects.equals(ConsoleAccountStatusEnum.FREEZE.name(), accountStatus)) {
return ConsoleAccountStatusEnum.NORMAL.getDesc();
}
return ConsoleAccountStatusEnum.getDescValue(this.getActualAccountStatus());
}
public String getActualAccountStatus() {
if (Objects.nonNull(this.freezingTime) && this.freezingTime.after(TimestampUtils.now())) {
return AccountStatusEnum.FREEZE.name();
}
if (Objects.equals(AccountStatusEnum.FREEZE.name(), this.accountStatus)) {
return AccountStatusEnum.NORMAL.name();
}
return this.accountStatus;
}
@JsonIgnore
public String getActualAccount() {
return checkOwnSpecialIdAvailable() ? this.ownSpecialId.getAccount() : this.account;
}
public String actualAccount() {
return checkOwnSpecialIdAvailable() ? this.ownSpecialId.getAccount() : this.account;
}
public String specialAccount() {
return checkOwnSpecialIdAvailable() ? this.ownSpecialId.getAccount() : null;
}
private boolean checkOwnSpecialIdAvailable() {
boolean exists = Objects.nonNull(this.ownSpecialId)
&& Objects.nonNull(this.ownSpecialId.getAccount());
if (!exists) {
return false;
}
return Objects.isNull(this.ownSpecialId.getExpiredTime())
|| this.ownSpecialId.getExpiredTime().after(TimestampUtils.now());
}
}

View File

@ -26,6 +26,7 @@ import com.red.circle.tool.core.text.StringUtils;
import com.red.circle.other.inner.asserts.user.UserErrorCode;
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
import com.red.circle.other.inner.endpoint.user.user.UserSvipClient;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.wallet.inner.endpoint.wallet.WalletDiamondClient;
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
@ -91,8 +92,8 @@ public class UserWalletServiceImpl implements UserWalletService {
return Lists.newArrayList();
}
Map<Long, UserProfileDTO> userProfileMap = ResponseAssert.requiredSuccess(
userProfileClient.mapByUserIds(
Map<Long, SimpleUserProfileDTO> userProfileMap = ResponseAssert.requiredSuccess(
userProfileClient.mapByUserIdsSimple(
runningWaters.stream().map(UserGoldRunningWaterHistoryDTO::getUserId)
.collect(Collectors.toSet())));
/*
@ -104,7 +105,7 @@ public class UserWalletServiceImpl implements UserWalletService {
return runningWaters.stream()
.map(runningWater -> {
UserProfileDTO userProfile = userProfileMap.get(runningWater.
SimpleUserProfileDTO userProfile = userProfileMap.get(runningWater.
getUserId());
if (Objects.isNull(userProfile)) {
@ -144,7 +145,7 @@ public class UserWalletServiceImpl implements UserWalletService {
List<UserGoldRunningWaterHistoryDTO> clsWaterWaters = clsWater.getWaters();
Map<Long, UserProfileDTO> userProfileMap = userProfileClient.mapByUserIds(
Map<Long, SimpleUserProfileDTO> userProfileMap = userProfileClient.mapByUserIdsSimple(
clsWaterWaters.stream().map(UserGoldRunningWaterHistoryDTO::getUserId)
.collect(Collectors.toSet())
).getBody();
@ -163,7 +164,7 @@ public class UserWalletServiceImpl implements UserWalletService {
.setWaters(clsWaterWaters.stream()
.map(runningWater -> {
UserProfileDTO userProfile = userProfileMap.get(runningWater.
SimpleUserProfileDTO userProfile = userProfileMap.get(runningWater.
getUserId());
if (Objects.isNull(userProfile)) {

View File

@ -1,7 +1,7 @@
package com.red.circle.console.app.dto.clienobject.user;
import cn.hutool.core.convert.Convert;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.wallet.inner.model.dto.UserGoldRunningWaterDTO;
import java.io.Serializable;
import lombok.Data;
@ -21,7 +21,7 @@ public class UserGoldRunningWaterCO extends Convert implements Serializable {
/**
* 用户资料.
*/
private UserProfileDTO userProfile;
private SimpleUserProfileDTO userProfile;
/**
* 流水.

View File

@ -27,6 +27,7 @@ import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRegisterInfoDTO;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRunProfileDTO;
import com.red.circle.other.inner.model.dto.user.WealthAndCharmExpLevelDTO;
import java.sql.Timestamp;
@ -108,4 +109,6 @@ public interface UserProfileInnerConvertor {
PageResult<UserProfileDTO> toListUserProfileDTO(PageResult<UserProfile> userProfiles);
Map<Long, UserProfileDTO> toMapUserProfileDTO(Map<Long, UserProfile> map);
SimpleUserProfileDTO toSimpleUserProfileDTO(UserProfile userProfile);
}

View File

@ -17,6 +17,7 @@ import com.red.circle.other.inner.model.cmd.user.UserBaseInfoCmd;
import com.red.circle.other.inner.model.cmd.user.UserProfileListQryCmd;
import com.red.circle.other.inner.model.cmd.user.UserRemoveUsePropsCmd;
import com.red.circle.other.inner.model.cmd.user.UserSwitchUsePropsCmd;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRegisterInfoDTO;
@ -267,4 +268,9 @@ public class UserProfileClientEndpoint implements UserProfileClientApi {
userProfileClientService.restoreAuthDelByUserId(userId);
return ResultResponse.success();
}
@Override
public ResultResponse<Map<Long, SimpleUserProfileDTO>> mapByUserIdsSimple(Set<Long> userIds) {
return ResultResponse.success(userProfileClientService.mapByUserIdsSimple(userIds));
}
}

View File

@ -8,6 +8,7 @@ import com.red.circle.other.inner.model.cmd.user.UpdateUserNicknameBatchCmd;
import com.red.circle.other.inner.model.cmd.user.UserBaseInfoCmd;
import com.red.circle.other.inner.model.cmd.user.UserProfileListQryCmd;
import com.red.circle.other.inner.model.dto.user.PetRelationshipFriendDTO;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRegisterInfoDTO;
@ -71,6 +72,11 @@ public interface UserProfileClientService {
*/
Map<Long, UserProfileDTO> mapByUserIds(Set<Long> userIds);
/**
* 获取用户资料集合简化版不含 cpList/backgroundPhotos/personalPhotos/useProps/badge/honor/firstRecharge.
*/
Map<Long, SimpleUserProfileDTO> mapByUserIdsSimple(Set<Long> userIds);
/**
* 根据id查询用户集合.
*/

View File

@ -35,6 +35,7 @@ import com.red.circle.other.inner.model.cmd.user.UpdateUserNicknameBatchCmd;
import com.red.circle.other.inner.model.cmd.user.UserBaseInfoCmd;
import com.red.circle.other.inner.model.cmd.user.UserProfileListQryCmd;
import com.red.circle.other.inner.model.dto.user.PetRelationshipFriendDTO;
import com.red.circle.other.inner.model.dto.user.SimpleUserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserPhotoWallDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserRegisterInfoDTO;
@ -200,6 +201,19 @@ public class UserProfileClientServiceImpl implements UserProfileClientService {
.collect(Collectors.toMap(UserProfile::getId, userProfileInnerConvertor::toUserProfileDTO));
}
@Override
public Map<Long, SimpleUserProfileDTO> mapByUserIdsSimple(Set<Long> userIds) {
if (CollectionUtils.isEmpty(userIds)) {
return Maps.newHashMap();
}
List<UserProfile> userProfiles = userProfileGateway.listByUserIds(userIds);
if (CollectionUtils.isEmpty(userProfiles)) {
return Maps.newHashMap();
}
return userProfiles.stream()
.collect(Collectors.toMap(UserProfile::getId, userProfileInnerConvertor::toSimpleUserProfileDTO));
}
@Override
public List<UserProfileDTO> listByUserId(Set<Long> userIds) {
return userProfileGateway.listByUserIds(userIds).stream()