Commit d80c70e8 by 田超

Merge branch 'feature/1003730' into 'master'

feat: [1003730] 应用作品收藏功能

See merge request rays/pcloud-book!999
parents 2eef7612 a0f8ce79
...@@ -20,6 +20,7 @@ import com.pcloud.book.base.exception.BookBizException; ...@@ -20,6 +20,7 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.app.AppConsr; import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr; import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz; import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
...@@ -390,6 +391,13 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -390,6 +391,13 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
String resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, appletRecordDTO.getLinkUrl()); String resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, appletRecordDTO.getLinkUrl());
appletAppOrProductDTO.setResultUrl(resultLinkUrl); appletAppOrProductDTO.setResultUrl(resultLinkUrl);
if (!StringUtil.isEmpty(appDto.getTurnUrl())){
appletAppOrProductDTO.setHasThirdLink(true);
} else {
appletAppOrProductDTO.setHasThirdLink(false);
}
appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.APP.value);
appletAppOrProductDTO.setServeId(appletRecordDTO.getFromId());
appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO); appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO);
} }
...@@ -435,6 +443,13 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -435,6 +443,13 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} else { } else {
appletAppOrProductDTO.setResultUrl(appletRecordDTO.getLinkUrl()); appletAppOrProductDTO.setResultUrl(appletRecordDTO.getLinkUrl());
} }
if (!StringUtil.isEmpty(productDto.getSkipUrl())){
appletAppOrProductDTO.setHasThirdLink(true);
} else {
appletAppOrProductDTO.setHasThirdLink(false);
}
appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.PRODUCT.value);
appletAppOrProductDTO.setServeId(appletRecordDTO.getFromId());
appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO); appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO);
} }
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.app.entity.AppType;
import com.pcloud.book.applet.biz.AppletNewsBiz; import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.ServeCollectBiz; import com.pcloud.book.applet.biz.ServeCollectBiz;
import com.pcloud.book.applet.dao.ServeCollectDao; import com.pcloud.book.applet.dao.ServeCollectDao;
...@@ -15,12 +16,14 @@ import com.pcloud.book.base.exception.BookBizException; ...@@ -15,12 +16,14 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.app.AppConsr; import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr; import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.skill.entity.PcloudResourceItem; import com.pcloud.book.skill.entity.PcloudResourceItem;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums; import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -188,6 +191,13 @@ public class ServeCollectBizImpl implements ServeCollectBiz { ...@@ -188,6 +191,13 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
} }
String resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, serveCollect.getLinkUrl()); String resultLinkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, serveCollect.getLinkUrl());
appletAppOrProductDTO.setResultUrl(resultLinkUrl); appletAppOrProductDTO.setResultUrl(resultLinkUrl);
if (!StringUtil.isEmpty(appDto.getTurnUrl())){
appletAppOrProductDTO.setHasThirdLink(true);
} else {
appletAppOrProductDTO.setHasThirdLink(false);
}
appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.APP.value);
appletAppOrProductDTO.setServeId(serveCollect.getServeId());
serveCollect.setAppletAppOrProductDTO(appletAppOrProductDTO); serveCollect.setAppletAppOrProductDTO(appletAppOrProductDTO);
} }
...@@ -233,6 +243,13 @@ public class ServeCollectBizImpl implements ServeCollectBiz { ...@@ -233,6 +243,13 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
} else { } else {
appletAppOrProductDTO.setResultUrl(serveCollect.getLinkUrl()); appletAppOrProductDTO.setResultUrl(serveCollect.getLinkUrl());
} }
if (!StringUtil.isEmpty(productDto.getSkipUrl())){
appletAppOrProductDTO.setHasThirdLink(true);
} else {
appletAppOrProductDTO.setHasThirdLink(false);
}
appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.PRODUCT.value);
appletAppOrProductDTO.setServeId(serveCollect.getServeId());
serveCollect.setAppletAppOrProductDTO(appletAppOrProductDTO); serveCollect.setAppletAppOrProductDTO(appletAppOrProductDTO);
} }
......
...@@ -16,4 +16,10 @@ public class AppletAppOrProductDTO { ...@@ -16,4 +16,10 @@ public class AppletAppOrProductDTO {
private String serveTypeCode; private String serveTypeCode;
@ApiModelProperty("结果链接") @ApiModelProperty("结果链接")
private String resultUrl; private String resultUrl;
@ApiModelProperty("商品应用中有第三方链接")
private Boolean hasThirdLink;
@ApiModelProperty("商品应用类型")
private String serveType;
@ApiModelProperty("商品应用id")
private Long serveId;
} }
...@@ -1300,7 +1300,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1300,7 +1300,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
Integer collage = 1; Integer collage = 1;
List<RightsNowItem> items = Lists.newArrayList(); List<RightsNowItem> items = Lists.newArrayList();
if (CollectionUtils.isEmpty(nowItems) && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) { if (CollectionUtils.isEmpty(nowItems) &&
rightsSettingTitle.getCollageState()!= null &&
rightsSettingTitle.getCollageState().intValue() == collage.intValue() &&
RightsServeTypeEnum.NEWS.name().equals(rightsSettingTitle.getServeType())) {
// 填充咨询 // 填充咨询
supplementNews(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId, itemType.value, officialAccountsId); supplementNews(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId, itemType.value, officialAccountsId);
// 处理权益中的应用/作品 // 处理权益中的应用/作品
...@@ -2143,101 +2146,170 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2143,101 +2146,170 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
// 获取抽奖权益 // 获取抽奖权益
if (RightsNowItemTypeNew.DRAW.value.equals(type)) { if (RightsNowItemTypeNew.DRAW.value.equals(type)) {
return setDraw(rightsSetting, wechatUserId, readType, bookId, officialAccountsId); setDraw(rightsSetting, wechatUserId, readType, bookId, officialAccountsId);
} }
// 获取学习工具权益 // 获取学习工具权益
if (RightsNowItemTypeNew.LEARNING_TOOL.value.equals(type)) { if (RightsNowItemTypeNew.LEARNING_TOOL.value.equals(type)) {
return setLearningTool(rightsSetting, wechatUserId, readType, bookId, officialAccountsId); setLearningTool(rightsSetting, wechatUserId, readType, bookId, officialAccountsId);
} }
// 获取线上网课权益 // 获取线上网课权益
if (RightsNowItemTypeNew.ONLINE_COURSE.value.equals(type)) { if (RightsNowItemTypeNew.ONLINE_COURSE.value.equals(type)) {
return setOnlineCourse(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId); setOnlineCourse(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId);
} }
// 获取专享礼券包权益 // 获取专享礼券包权益
if (RightsNowItemTypeNew.GIFT_COUPON_PACKAGE.value.equals(type)) { if (RightsNowItemTypeNew.GIFT_COUPON_PACKAGE.value.equals(type)) {
return setGiftCouponPackage(rightsSetting, wechatUserId, readType, bookId); setGiftCouponPackage(rightsSetting, wechatUserId, readType, bookId);
} }
// 获取专享社群 // 获取专享社群
if (RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)) { if (RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)) {
return setGroupService(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId); setGroupService(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId);
} }
// 老师1V1 // 老师1V1
if (RightsNowItemTypeNew.COACH.value.equals(type)) { if (RightsNowItemTypeNew.COACH.value.equals(type)) {
return setCoach1V1(rightsSetting, wechatUserId, readType, bookId, officialAccountsId); setCoach1V1(rightsSetting, wechatUserId, readType, bookId, officialAccountsId);
} }
// 获取线上专课 // 获取线上专课
if (RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value.equals(type)) { if (RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value.equals(type)) {
return setOnlineExclCourse(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId); setOnlineExclCourse(rightsSetting, wechatUserId, readType, bookId, currentPage, numPerPage,officialAccountsId);
} }
fillCollect(wechatUserId, rightsSetting, type);
return rightsSetting; return rightsSetting;
} }
private void fillCollect(Long wechatUserId, RightsSetting rightsSetting4Serves, Integer type) { private void fillCollect(Long wechatUserId, RightsSetting rightsSetting4Serves, Integer type) {
if (null == wechatUserId) { if (null == wechatUserId || null == rightsSetting4Serves) {
return; return;
} }
List<RightsNowItem> rightsNowItemList = new ArrayList<>();
if (RightsNowItemTypeNew.SERVES.value.equals(type)) { if (RightsNowItemTypeNew.SERVES.value.equals(type)) {
List<RightsItemGroup> rightsItemGroups = rightsSetting4Serves.getRightsItemGroups(); if (fillCollect4Serve(wechatUserId, rightsSetting4Serves)) return;
if (ListUtils.isEmpty(rightsItemGroups)) { } else if (RightsNowItemTypeNew.ONLINE_COURSE.value.equals(type)) {
return; if (null != rightsSetting4Serves.getOnlineRightsSettingTitle() && !ListUtils.isEmpty(rightsSetting4Serves.getOnlineRightsSettingTitle().getRightsSettingItemList())){
rightsNowItemList = rightsSetting4Serves.getOnlineRightsSettingTitle().getRightsSettingItemList();
} }
List<RightsNowItem> rightsNowItems = new ArrayList<>(); } else if (RightsNowItemTypeNew.LEARNING_TOOL.value.equals(type)) {
rightsItemGroups.forEach(rightsItemGroup -> { if (null != rightsSetting4Serves.getLearningToolTitle() && !ListUtils.isEmpty(rightsSetting4Serves.getLearningToolTitle().getRightsSettingItemList())){
List<RightsNowItem> nowItems = rightsItemGroup.getRightsNowItems(); rightsNowItemList = rightsSetting4Serves.getLearningToolTitle().getRightsSettingItemList();
if (ListUtils.isEmpty(nowItems)) {
return;
}
List<RightsNowItem> productOrApps = nowItems.stream().filter(e -> Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ||
Objects.equals(e.getServeType(), AppAndProductTypeEnum.APP.value)).collect(Collectors.toList());
if (!ListUtils.isEmpty(productOrApps)) {
rightsNowItems.addAll(productOrApps);
}
});
if (ListUtils.isEmpty(rightsNowItems)) {
return;
} }
List<ServeCollect> serveCollects = new ArrayList<>(); } else if (RightsNowItemTypeNew.DRAW.value.equals(type)) {
rightsNowItems.forEach(e -> { if (null != rightsSetting4Serves.getDrawSettingTitle() && !ListUtils.isEmpty(rightsSetting4Serves.getDrawSettingTitle().getRightsSettingItemList())){
ServeCollect serveCollect = new ServeCollect(); rightsNowItemList = rightsSetting4Serves.getDrawSettingTitle().getRightsSettingItemList();
serveCollect.setWechatUserId(wechatUserId); }
serveCollect.setServeId(e.getServeId()); } else if (RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value.equals(type)) {
serveCollect.setServeType(Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ? AppletRecordTypeEnum.PRODUCT.value : AppletRecordTypeEnum.APP.value); if (null != rightsSetting4Serves.getOnlineRightsSettingTitle() && !ListUtils.isEmpty(rightsSetting4Serves.getOnlineRightsSettingTitle().getRightsSettingItemList())){
serveCollects.add(serveCollect); rightsNowItemList = rightsSetting4Serves.getOnlineRightsSettingTitle().getRightsSettingItemList();
}); }
List<ServeCollect> serveCollectList = serveCollectBiz.getList4RightsSetting(serveCollects); } else if (RightsNowItemTypeNew.COACH.value.equals(type)) {
if (ListUtils.isEmpty(serveCollectList)) { if (null != rightsSetting4Serves.getLearningToolTitle() && !ListUtils.isEmpty(rightsSetting4Serves.getLearningToolTitle().getRightsSettingItemList())){
rightsNowItemList = rightsSetting4Serves.getLearningToolTitle().getRightsSettingItemList();
}
}
if (!ListUtils.isEmpty(rightsNowItemList)) {
fillCollect4RightsNowItem(wechatUserId,rightsNowItemList);
}
}
private boolean fillCollect4Serve(Long wechatUserId, RightsSetting rightsSetting4Serves) {
List<RightsItemGroup> rightsItemGroups = rightsSetting4Serves.getRightsItemGroups();
if (ListUtils.isEmpty(rightsItemGroups)) {
return true;
}
List<RightsNowItem> rightsNowItems = new ArrayList<>();
rightsItemGroups.forEach(rightsItemGroup -> {
List<RightsNowItem> nowItems = rightsItemGroup.getRightsNowItems();
if (ListUtils.isEmpty(nowItems)) {
return; return;
} }
List<ServeCollect> collect4Product = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.PRODUCT.value)).collect(Collectors.toList()); List<RightsNowItem> productOrApps = nowItems.stream().filter(e -> Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ||
List<ServeCollect> collect4App = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.APP.value)).collect(Collectors.toList()); Objects.equals(e.getServeType(), AppAndProductTypeEnum.APP.value)).collect(Collectors.toList());
Map<Long, ServeCollect> serveCollectMap4Product = new HashMap<>(); if (!ListUtils.isEmpty(productOrApps)) {
Map<Long, ServeCollect> serveCollectMap4App = new HashMap<>(); rightsNowItems.addAll(productOrApps);
if (!ListUtils.isEmpty(collect4Product)) {
serveCollectMap4Product = collect4Product.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1));
} }
if (!ListUtils.isEmpty(collect4App)) { });
serveCollectMap4App = collect4App.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1)); if (ListUtils.isEmpty(rightsNowItems)) {
return true;
}
List<ServeCollect> serveCollects = new ArrayList<>();
rightsNowItems.forEach(e -> {
ServeCollect serveCollect = new ServeCollect();
serveCollect.setWechatUserId(wechatUserId);
serveCollect.setServeId(e.getServeId());
serveCollect.setServeType(Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ? AppletRecordTypeEnum.PRODUCT.value : AppletRecordTypeEnum.APP.value);
serveCollects.add(serveCollect);
});
List<ServeCollect> serveCollectList = serveCollectBiz.getList4RightsSetting(serveCollects);
if (ListUtils.isEmpty(serveCollectList)) {
return true;
}
List<ServeCollect> collect4Product = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.PRODUCT.value)).collect(Collectors.toList());
List<ServeCollect> collect4App = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.APP.value)).collect(Collectors.toList());
Map<Long, ServeCollect> serveCollectMap4Product = new HashMap<>();
Map<Long, ServeCollect> serveCollectMap4App = new HashMap<>();
if (!ListUtils.isEmpty(collect4Product)) {
serveCollectMap4Product = collect4Product.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1));
}
if (!ListUtils.isEmpty(collect4App)) {
serveCollectMap4App = collect4App.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1));
}
for (RightsItemGroup rightsItemGroup : rightsItemGroups) {
List<RightsNowItem> nowItems = rightsItemGroup.getRightsNowItems();
if (ListUtils.isEmpty(nowItems)) {
continue;
} }
for (RightsItemGroup rightsItemGroup : rightsItemGroups) { List<RightsNowItem> productOrApps = nowItems.stream().filter(e -> Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ||
List<RightsNowItem> nowItems = rightsItemGroup.getRightsNowItems(); Objects.equals(e.getServeType(), AppAndProductTypeEnum.APP.value)).collect(Collectors.toList());
if (ListUtils.isEmpty(nowItems)) { if (!ListUtils.isEmpty(productOrApps)) {
continue; for (RightsNowItem rightsNowItem : productOrApps) {
} if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.PRODUCT.value) && MapUtils.isNotEmpty(serveCollectMap4Product) &&
List<RightsNowItem> productOrApps = nowItems.stream().filter(e -> Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) || null != serveCollectMap4Product.get(rightsNowItem.getServeId())) {
Objects.equals(e.getServeType(), AppAndProductTypeEnum.APP.value)).collect(Collectors.toList()); rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
if (!ListUtils.isEmpty(productOrApps)) { } else if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.APP.value) && MapUtils.isNotEmpty(serveCollectMap4App) &&
for (RightsNowItem rightsNowItem : productOrApps) { null != serveCollectMap4App.get(rightsNowItem.getServeId())) {
if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.PRODUCT.value) && MapUtils.isNotEmpty(serveCollectMap4Product) && rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
null != serveCollectMap4Product.get(rightsNowItem.getServeId())) {
rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
} else if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.APP.value) && MapUtils.isNotEmpty(serveCollectMap4App) &&
null != serveCollectMap4App.get(rightsNowItem.getServeId())) {
rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
}
} }
} }
} }
} }
return false;
}
private void fillCollect4RightsNowItem(Long wechatUserId, List<RightsNowItem> rightsNowItems) {
log.info("为应用或作品填充是否收藏");
List<ServeCollect> serveCollects = new ArrayList<>();
rightsNowItems.forEach(e -> {
ServeCollect serveCollect = new ServeCollect();
serveCollect.setWechatUserId(wechatUserId);
serveCollect.setServeId(e.getServeId());
serveCollect.setServeType(Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ? AppletRecordTypeEnum.PRODUCT.value : AppletRecordTypeEnum.APP.value);
serveCollects.add(serveCollect);
});
List<ServeCollect> serveCollectList = serveCollectBiz.getList4RightsSetting(serveCollects);
if (ListUtils.isEmpty(serveCollectList)) {
return;
}
List<ServeCollect> collect4Product = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.PRODUCT.value)).collect(Collectors.toList());
List<ServeCollect> collect4App = serveCollectList.stream().filter(e -> Objects.equals(e.getServeType(), AppletRecordTypeEnum.APP.value)).collect(Collectors.toList());
Map<Long, ServeCollect> serveCollectMap4Product = new HashMap<>();
Map<Long, ServeCollect> serveCollectMap4App = new HashMap<>();
if (!ListUtils.isEmpty(collect4Product)) {
serveCollectMap4Product = collect4Product.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1));
}
if (!ListUtils.isEmpty(collect4App)) {
serveCollectMap4App = collect4App.stream().collect(Collectors.toMap(e -> e.getServeId(), a -> a, (k1, k2) -> k1));
}
List<RightsNowItem> productOrApps = rightsNowItems.stream().filter(e -> Objects.equals(e.getServeType(), AppAndProductTypeEnum.PRODUCT.value) ||
Objects.equals(e.getServeType(), AppAndProductTypeEnum.APP.value)).collect(Collectors.toList());
if (!ListUtils.isEmpty(productOrApps)) {
for (RightsNowItem rightsNowItem : productOrApps) {
if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.PRODUCT.value) && MapUtils.isNotEmpty(serveCollectMap4Product) &&
null != serveCollectMap4Product.get(rightsNowItem.getServeId())) {
rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
} else if (Objects.equals(rightsNowItem.getServeType(), AppAndProductTypeEnum.APP.value) && MapUtils.isNotEmpty(serveCollectMap4App) &&
null != serveCollectMap4App.get(rightsNowItem.getServeId())) {
rightsNowItem.setIsCollect(YesOrNoEnums.YES.getValue());
}
}
}
} }
@ParamLog(value = "填充专享社群", isAfterReturn = false) @ParamLog(value = "填充专享社群", isAfterReturn = false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment