|
@@ -73,36 +73,19 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|
|
if (StringUtils.isEmpty(userId)) {
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
- UserInfoVO userVO = userAPi.getInfoById(userId).getResult();
|
|
|
+ UserInfoVO userVO = userAPi.getMemberInfoById(userId).getResult();
|
|
|
if (null == userVO) {
|
|
|
log.error("用户不存在,id:{}", userId);
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
List<UserSubscriptionInfoVO> subscriptionInfoList = userVO.getSubscriptionInfoList();
|
|
|
-// List<OrdersVO> orders = orderApi.getOrderByUserId(userId).getResult();
|
|
|
// 买断的产品 或者 没有购买过的用户直接返回价格
|
|
|
if (CollectionUtils.isEmpty(subscriptionInfoList) || listingProductVO.getPaymentModel() == 2) {
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
// 订阅产品,判断用户购买情况和是否买断升级订阅
|
|
|
- List<String> orderProductIds = subscriptionInfoList.stream().filter(Objects::nonNull).filter(s -> s.getStatus() != 2 && s.getStatus() != 4)
|
|
|
- .map(UserSubscriptionInfoVO::getProductId).collect(Collectors.toList());;
|
|
|
- /*if (null != isEducation && isEducation == 1) {
|
|
|
- // 获取已购买的教育订单商品
|
|
|
- orderProductIds = orders.stream().filter(Objects::nonNull)
|
|
|
- .filter(ordersVO -> ordersVO.getStatus() == 2 && null != ordersVO.getDiscountType() && ordersVO.getDiscountType() == 3)
|
|
|
- .map(OrdersVO::getProductId).collect(Collectors.toList());
|
|
|
- } else {
|
|
|
- // 获取所有订单商品
|
|
|
- orderProductIds = orders.stream().filter(Objects::nonNull)
|
|
|
- .filter(ordersVO -> ordersVO.getStatus() == 2)
|
|
|
- .map(OrdersVO::getProductId).collect(Collectors.toList());
|
|
|
- }*/
|
|
|
- if (CollectionUtils.isEmpty(orderProductIds)) {
|
|
|
- return listingProductVO;
|
|
|
- }
|
|
|
- List<ListingProductVO> orderProducts = productApi.getProductsByIds(orderProductIds).getResult();
|
|
|
- if (CollectionUtils.isEmpty(orderProducts)) {
|
|
|
+ List<UserSubscriptionInfoVO> userSubscriptionInfoVOList = subscriptionInfoList.stream().filter(Objects::nonNull).filter(s -> s.getStatus() != 2 && s.getStatus() != 4).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(userSubscriptionInfoVOList)) {
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
// 筛选订单购买的产品中有没有vip订阅类型
|
|
@@ -110,23 +93,23 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|
|
boolean hasSVip = false;
|
|
|
// 买断版 平台数
|
|
|
int permanentPlatform = 0;
|
|
|
- for (ListingProductVO orderProduct : orderProducts) {
|
|
|
+ for (UserSubscriptionInfoVO userSubscriptionInfoVO : userSubscriptionInfoVOList) {
|
|
|
// 买断的产品,判断是否多平台
|
|
|
- if (orderProduct.getPaymentModel() == 2 && StringUtils.isNotEmpty(orderProduct.getPlatforms())) {
|
|
|
+ if (userSubscriptionInfoVO.getPaymentModel().equals("2") && StringUtils.isNotEmpty(userSubscriptionInfoVO.getPlatforms())) {
|
|
|
int count = 0;
|
|
|
- if (orderProduct.getPlatforms().contains("Mac")) count++;
|
|
|
- if (orderProduct.getPlatforms().contains("Windows")) count++;
|
|
|
- if (orderProduct.getPlatforms().contains("iOS")) count++;
|
|
|
- if (orderProduct.getPlatforms().contains("Android")) count++;
|
|
|
+ if (userSubscriptionInfoVO.getPlatforms().contains("Mac")) count++;
|
|
|
+ if (userSubscriptionInfoVO.getPlatforms().contains("Windows")) count++;
|
|
|
+ if (userSubscriptionInfoVO.getPlatforms().contains("iOS")) count++;
|
|
|
+ if (userSubscriptionInfoVO.getPlatforms().contains("Android")) count++;
|
|
|
if (count == 1) {
|
|
|
permanentPlatform = 1;
|
|
|
} else if (count > 1) {
|
|
|
permanentPlatform = 2;
|
|
|
}
|
|
|
} else {
|
|
|
- if (StringUtils.isNotEmpty(orderProduct.getLevels())&&orderProduct.getLevels().contains("2")) {
|
|
|
+ if (StringUtils.isNotEmpty(userSubscriptionInfoVO.getLevels())&&userSubscriptionInfoVO.getLevels().contains("2")) {
|
|
|
hasVip = true;
|
|
|
- } else if (StringUtils.isNotEmpty(orderProduct.getLevels())&&orderProduct.getLevels().contains("3")) {
|
|
|
+ } else if (StringUtils.isNotEmpty(userSubscriptionInfoVO.getLevels())&&userSubscriptionInfoVO.getLevels().contains("3")) {
|
|
|
hasSVip = true;
|
|
|
}
|
|
|
}
|