|
@@ -12,6 +12,7 @@ import cn.kdan.cloud.pdf.office.common.enums.product.ProductEducationPriceEnum;
|
|
|
import cn.kdan.cloud.pdf.office.common.exception.BackendRuntimeException;
|
|
|
import cn.kdan.cloud.pdf.office.common.pojo.ResultMap;
|
|
|
import cn.kdan.cloud.pdf.office.common.vo.UserInfoVO;
|
|
|
+import cn.kdan.cloud.pdf.office.common.vo.UserSubscriptionInfoVO;
|
|
|
import cn.kdan.cloud.pdf.office.common.vo.UserVO;
|
|
|
import cn.kdan.cloud.pdf.office.website.service.ProductInfoService;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -77,14 +78,15 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|
|
log.error("用户不存在,id:{}", userId);
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
- List<OrdersVO> orders = orderApi.getOrderByUserId(userId).getResult();
|
|
|
+ List<UserSubscriptionInfoVO> subscriptionInfoList = userVO.getSubscriptionInfoList();
|
|
|
+// List<OrdersVO> orders = orderApi.getOrderByUserId(userId).getResult();
|
|
|
// 买断的产品 或者 没有购买过的用户直接返回价格
|
|
|
- if (CollectionUtils.isEmpty(orders) || listingProductVO.getPaymentModel() == 2) {
|
|
|
+ if (CollectionUtils.isEmpty(subscriptionInfoList) || listingProductVO.getPaymentModel() == 2) {
|
|
|
return listingProductVO;
|
|
|
}
|
|
|
// 订阅产品,判断用户购买情况和是否买断升级订阅
|
|
|
- List<String> orderProductIds = orders.stream().filter(Objects::nonNull).filter(ordersVO -> ordersVO.getStatus() == 2)
|
|
|
- .map(OrdersVO::getProductId).collect(Collectors.toList());;
|
|
|
+ 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)
|
|
@@ -138,7 +140,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|
|
// 有svip购买svip
|
|
|
if (hasSVip) {
|
|
|
// 判断用户是否还在订阅中,
|
|
|
- if (userVO.getSubscriptionInfoList().stream().filter(Objects::nonNull)
|
|
|
+ if (subscriptionInfoList.stream().filter(Objects::nonNull)
|
|
|
.anyMatch(userSubscriptionInfoVO -> userSubscriptionInfoVO.getPlatform().equals(2) && userSubscriptionInfoVO.getPayType() == 1)) {
|
|
|
throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_USER_ALREADY_SUBSCRIBED);
|
|
|
}
|
|
@@ -162,7 +164,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
|
|
|
// vip提前续费
|
|
|
if (hasVip) {
|
|
|
// 判断用户是否还在订阅中,
|
|
|
- if (userVO.getSubscriptionInfoList().stream().filter(Objects::nonNull)
|
|
|
+ if (subscriptionInfoList.stream().filter(Objects::nonNull)
|
|
|
.anyMatch(userSubscriptionInfoVO -> userSubscriptionInfoVO.getPlatform().equals(2) && userSubscriptionInfoVO.getPayType() == 1)) {
|
|
|
throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_USER_ALREADY_SUBSCRIBED);
|
|
|
}
|