Bob пре 4 месеци
родитељ
комит
e21b36420f

+ 0 - 17
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/OrderServiceImpl.java

@@ -332,23 +332,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             log.error("请求支付中台创建订单失败", e);
             throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_MSG_ORDER_CREATE_FAILED);
         }
-
-        /*HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
-        headers.set(HttpHeaders.AUTHORIZATION, authorization);
-        try {
-            HttpEntity<String> request = new HttpEntity<>(JSONObject.toJSONString(jsonObject), headers);
-            ResponseEntity<JSONObject> response = restTemplate.exchange(payCenterConfigProperties.getPayCenterUrl() + payCenterConfigProperties.getCreateOrderMethod(), HttpMethod.POST, request, JSONObject.class);
-            if (!response.getStatusCode().is2xxSuccessful() || !Objects.requireNonNull(response.getBody()).getBoolean("success")) {
-                log.error("请求支付中台创建订单失败,body信息:{}", response.getBody());
-                return null;
-            }
-            // 获取支付链接
-            return response.getBody().getString("payHref");
-        } catch (Exception e) {
-            log.error("创建订单失败", e);
-        }*/
         return null;
     }
 

+ 8 - 6
pdf-office-pdf-website/src/main/java/cn/kdan/cloud/pdf/office/website/service/impl/ProductInfoServiceImpl.java

@@ -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);
                 }