From 0a5baf60726f9b5bef3dd494eed5378394041dfb Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 26 Nov 2025 15:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E5=8C=85=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=B0=E5=A2=9Eaccount=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query/QueryRoomRedPacketDetailQryExe.java | 17 ++++++++++++++--- .../query/QueryRoomRedPacketListQryExe.java | 1 + .../app/dto/clientobject/RoomRedPacketCO.java | 5 +++++ .../dto/clientobject/RoomRedPacketDetailCO.java | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketDetailQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketDetailQryExe.java index 8b7730dc..6e5572dc 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketDetailQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketDetailQryExe.java @@ -6,6 +6,8 @@ import com.red.circle.other.app.dto.clientobject.RoomRedPacketDetailCO; import com.red.circle.other.app.dto.cmd.QueryRoomRedPacketDetailCmd; import com.red.circle.other.domain.gateway.RoomRedPacketGateway; import com.red.circle.other.domain.gateway.RoomRedPacketRecordGateway; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.redpacket.RoomRedPacket; import com.red.circle.other.domain.redpacket.RoomRedPacketRecord; import com.red.circle.other.infra.database.cache.service.other.RoomRedPacketCacheService; @@ -14,8 +16,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Optional; +import java.util.*; /** * 查询红包详情执行器 @@ -28,6 +29,7 @@ public class QueryRoomRedPacketDetailQryExe { private final RoomRedPacketGateway roomRedPacketGateway; private final RoomRedPacketRecordGateway roomRedPacketRecordGateway; private final RoomRedPacketCacheService roomRedPacketCacheService; + private final UserProfileGateway userProfileGateway; /** * 执行查询 @@ -49,7 +51,16 @@ public class QueryRoomRedPacketDetailQryExe { // 4. 检查当前用户是否已领取 boolean grabbed = roomRedPacketCacheService.hasUserGrabbed(packetId, userId); detailCO.setGrabbed(grabbed); - + + Map profileMap = userProfileGateway.mapByUserIds(Set.of(detailCO.getUserId())); + UserProfile userProfile = profileMap.get(userId); + if (userProfile != null) { + detailCO.setUserId(userProfile.getId()); + detailCO.setAccount(userProfile.getAccount()); + detailCO.setUserName(userProfile.getUserNickname()); + detailCO.setUserAvatar(userProfile.getUserAvatar()); + } + // 5. 如果当前用户已领取,设置领取金额 if (grabbed) { Optional myRecord = records.stream() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketListQryExe.java index 54fc12e3..ad913f12 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/query/QueryRoomRedPacketListQryExe.java @@ -58,6 +58,7 @@ public class QueryRoomRedPacketListQryExe { UserProfile userProfile = profileMap.get(redPacket.getUserId()); if (userProfile != null) { + co.setAccount(userProfile.getAccount()); co.setUserAvatar(userProfile.getUserAvatar()); co.setUserName(userProfile.getUserNickname()); co.setUserId(userProfile.getId()); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketCO.java index 536a1b3a..fad26955 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketCO.java @@ -25,6 +25,11 @@ public class RoomRedPacketCO { */ private Long userId; + /** + * 账号 + */ + private String account; + /** * 发起人昵称 */ diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketDetailCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketDetailCO.java index 9d669faf..e7ef4ef3 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketDetailCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/RoomRedPacketDetailCO.java @@ -21,6 +21,11 @@ public class RoomRedPacketDetailCO { */ private Long userId; + /** + * 账号 + */ + private String account; + /** * 发起人昵称 */