红包列表接口新增account字段

This commit is contained in:
tianfeng 2025-11-26 15:23:06 +08:00
parent 3b111efa04
commit 0a5baf6072
4 changed files with 25 additions and 3 deletions

View File

@ -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<Long, UserProfile> 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<RoomRedPacketRecord> myRecord = records.stream()

View File

@ -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());

View File

@ -25,6 +25,11 @@ public class RoomRedPacketCO {
*/
private Long userId;
/**
* 账号
*/
private String account;
/**
* 发起人昵称
*/

View File

@ -21,6 +21,11 @@ public class RoomRedPacketDetailCO {
*/
private Long userId;
/**
* 账号
*/
private String account;
/**
* 发起人昵称
*/