活动礼物列表新增活动ID字段
This commit is contained in:
parent
301c183b5e
commit
1f03ec5558
@ -42,16 +42,15 @@ public class ActivityGiftListQryExe {
|
||||
}
|
||||
|
||||
// 构建 giftId -> bannerId 的映射(取第一个遇到的 bannerId)
|
||||
Map<Long, Long> giftIdToBannerIdMap = new HashMap<>();
|
||||
Map<Long, ActivityConfig> giftIdToBannerIdMap = new HashMap<>();
|
||||
List<Long> giftIds = new ArrayList<>();
|
||||
|
||||
for (ActivityConfig activity : activities) {
|
||||
Long bannerId = activity.getBannerId();
|
||||
if (CollectionUtils.isNotEmpty(activity.getGiftIds())) {
|
||||
for (Object giftIdObj : activity.getGiftIds()) {
|
||||
Long giftId = Long.valueOf(giftIdObj.toString());
|
||||
if (!giftIdToBannerIdMap.containsKey(giftId)) {
|
||||
giftIdToBannerIdMap.put(giftId, bannerId);
|
||||
giftIdToBannerIdMap.put(giftId, activity);
|
||||
giftIds.add(giftId);
|
||||
}
|
||||
}
|
||||
@ -64,7 +63,7 @@ public class ActivityGiftListQryExe {
|
||||
|
||||
// 收集所有需要查询的 bannerId(去重)
|
||||
List<Long> bannerIds = giftIdToBannerIdMap.values().stream()
|
||||
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
.filter(Objects::nonNull).map(ActivityConfig::getBannerId).distinct().collect(Collectors.toList());
|
||||
|
||||
Map<Long, String> bannerUrlMap;
|
||||
if (!bannerIds.isEmpty()) {
|
||||
@ -88,7 +87,7 @@ public class ActivityGiftListQryExe {
|
||||
}
|
||||
|
||||
private ActivityGiftCO convertToActivityGiftCO(GiftConfig giftConfig,
|
||||
Map<Long, Long> giftIdToBannerIdMap,
|
||||
Map<Long, ActivityConfig> giftIdToBannerIdMap,
|
||||
Map<Long, String> bannerUrlMap) {
|
||||
ActivityGiftCO activityGiftCO = new ActivityGiftCO();
|
||||
activityGiftCO.setId(giftConfig.getId());
|
||||
@ -103,9 +102,10 @@ public class ActivityGiftListQryExe {
|
||||
activityGiftCO.setExpiredTime(giftConfig.getExpiredTime());
|
||||
|
||||
// 设置 bannerUrl
|
||||
Long bannerId = giftIdToBannerIdMap.get(giftConfig.getId());
|
||||
String bannerUrl = (bannerId != null) ? bannerUrlMap.get(bannerId) : null;
|
||||
ActivityConfig activityConfig = giftIdToBannerIdMap.get(giftConfig.getId());
|
||||
String bannerUrl = (activityConfig.getBannerId() != null) ? bannerUrlMap.get(activityConfig.getBannerId()) : null;
|
||||
activityGiftCO.setBannerUrl(bannerUrl);
|
||||
activityGiftCO.setActivityId(activityConfig.getId());
|
||||
|
||||
return activityGiftCO;
|
||||
}
|
||||
|
||||
@ -72,6 +72,11 @@ public class ActivityGiftCO extends ClientObject {
|
||||
*/
|
||||
private Timestamp expiredTime;
|
||||
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* banner地址.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user