From 065611a20f552cd3c8b77a0655f6b90bbe75969d Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 13 Feb 2026 19:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=A4=BC=E7=89=A9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20=E5=88=86=E5=8C=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/gift/query/ActivityGiftListQryExe.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/query/ActivityGiftListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/query/ActivityGiftListQryExe.java index 28514999..b202ae8e 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/query/ActivityGiftListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/query/ActivityGiftListQryExe.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.other.app.dto.clientobject.gift.ActivityGiftCO; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +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.cache.service.other.BannerCacheService; import com.red.circle.other.infra.database.mongo.entity.sys.ActivityConfig; import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService; @@ -15,6 +18,8 @@ import com.red.circle.tool.core.collection.CollectionUtils; import java.util.*; import java.util.stream.Collectors; + +import com.red.circle.tool.core.text.StringUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -32,6 +37,8 @@ public class ActivityGiftListQryExe { private final ActivityConfigService activityConfigService; private final GiftConfigService giftConfigService; private final BannerConfigService bannerConfigService; + private final UserProfileGateway userProfileGateway; + private final UserRegionGateway userRegionGateway; public List execute(AppExtCommand cmd) { // 获取进行中的活动 @@ -61,6 +68,10 @@ public class ActivityGiftListQryExe { return new ArrayList<>(); } + String regionId = userRegionGateway.getRegionId(cmd.requiredReqUserId()); + UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId()); + String countryCode = userProfile.getCountryCode(); + // 收集所有需要查询的 bannerId(去重) List bannerIds = giftIdToBannerIdMap.values().stream() .filter(Objects::nonNull).map(ActivityConfig::getBannerId).distinct().collect(Collectors.toList()); @@ -70,12 +81,15 @@ public class ActivityGiftListQryExe { LambdaQueryWrapper query = Wrappers.lambdaQuery() .in(BannerConfig::getId, bannerIds); bannerUrlMap = bannerConfigService.list(query).stream() + .filter(bannerCache -> StringUtils.isBlank(bannerCache.getRegions()) || bannerCache.getRegions().contains(regionId)) + .filter(bannerCache -> StringUtils.isBlank(bannerCache.getCountryCode()) || bannerCache.getCountryCode().contains(countryCode)) .collect(Collectors.toMap(BannerConfig::getId, e -> e, (u1, u2) -> u1)); } else { bannerUrlMap = new HashMap<>(); } // 查询礼物配置 List giftConfigs = giftConfigService.listByIds(giftIds); + giftConfigs = giftConfigs.stream().filter(gift -> StringUtils.isBlank(gift.getRegions()) || gift.getRegions().contains(regionId != null ? regionId : "null")).toList(); if (CollectionUtils.isEmpty(giftConfigs)) { return new ArrayList<>(); }