浏览代码

Bug修复

tangxiangan 5 天之前
父节点
当前提交
c8b5eef221

+ 3 - 2
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/OrderService.java

@@ -138,10 +138,11 @@ public interface OrderService extends IService<Order> {
 
     /**
      * 根据第三方id获取订单
-     * @param thirdOrderNo 第三方id
+     *
+     * @param thirdTradeNo 第三方id
      * @return
      */
-    List<OrdersVO> getOrderListByThirdOrderNo(String thirdOrderNo);
+    List<OrdersVO> getOrderListByThirdTradeNo(String thirdTradeNo);
 
     Order getOrderByUserIdAndProductId(String userId, String productId);
 }

+ 2 - 2
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/AppStoreServiceImpl.java

@@ -118,7 +118,7 @@ public class AppStoreServiceImpl implements AppStoreService {
             createSubscription.setEmail(userVO.getEmail());
             createSubscription.setBuyerType(4);//2官网购买 3后台赠送 4appstore
             createSubscription.setSubscriptionType(SubscriptionTypeEnum.MEMBER.value());//如果是0则是试用
-            createSubscription.setPaymentModel(2);
+            createSubscription.setPaymentModel(product.getPaymentModel());
             createSubscription.setPrice(price);
             createSubscription.setPayTime(0);
             subscriptionsService.createSubscription(createSubscription);
@@ -136,7 +136,7 @@ public class AppStoreServiceImpl implements AppStoreService {
                     .paymentMethod(PaymentMethodEnum.APPLE_PAY)
                     .appId(appId)
                     .productId(product.getId())
-                    .paymentModel(2)
+                    .paymentModel(product.getPaymentModel())
                     .subscriptionType(1)
                     .payNumber(1)
                     .tradeNo(readeNo)

+ 2 - 2
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/GooglePayServiceImpl.java

@@ -131,7 +131,7 @@ public class GooglePayServiceImpl implements GooglePayService {
         createSubscription.setEmail(userVO.getEmail());
         createSubscription.setBuyerType(5);//2官网购买 3后台赠送 4appstore
         createSubscription.setSubscriptionType(SubscriptionTypeEnum.MEMBER.value());//如果是0则是试用
-        createSubscription.setPaymentModel(2);
+        createSubscription.setPaymentModel(product.getPaymentModel());
         createSubscription.setPrice(price);
         createSubscription.setPayTime(0);
         subscriptionsService.createSubscription(createSubscription);
@@ -149,7 +149,7 @@ public class GooglePayServiceImpl implements GooglePayService {
                 .appId(appId)
                 .productId(productId)
                 //安卓全是自动续费
-                .paymentModel(2)
+                .paymentModel(product.getPaymentModel())
                 .subscriptionType(1)
                 .payNumber(1)
                 .tradeNo(readeNo)

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

@@ -311,7 +311,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 String responseBody = response.body().string();
                 JSONObject jsonResponse = JSON.parseObject(responseBody);
                 String payHref = jsonResponse.getJSONObject("data").getString("payHref");
-                order.setThirdOrderNo(jsonResponse.getJSONObject("data").getString("id"));
+                order.setThirdTradeNo(jsonResponse.getJSONObject("data").getString("id"));
                 order.setPagePayUrl(payHref);
                 this.baseMapper.insert(order);
                 // 订单关闭
@@ -470,7 +470,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 String responseBody = response.body().string();
                 JSONObject jsonResponse = JSON.parseObject(responseBody);
                 String payHref = jsonResponse.getJSONObject("data").getString("payHref");
-                order.setThirdOrderNo(jsonResponse.getJSONObject("data").getString("id"));
+                order.setThirdTradeNo(jsonResponse.getJSONObject("data").getString("id"));
                 order.setPagePayUrl(payHref);
                 this.baseMapper.insert(order);
                 // 订单关闭
@@ -652,7 +652,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                     .readTimeout(300, TimeUnit.SECONDS)
                     .writeTimeout(300, TimeUnit.SECONDS)
                     .build();
-            String url = payCenterConfigProperties.getPayCenterUrl() + payCenterConfigProperties.getCapturePaypalMethod() + "?tradeId=" + order.getThirdOrderNo();
+            String url = payCenterConfigProperties.getPayCenterUrl() + payCenterConfigProperties.getCapturePaypalMethod() + "?tradeId=" + order.getThirdTradeNo();
             Request request = new Request.Builder()
                     .url(url)
                     .method("GET", null)
@@ -824,8 +824,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     }
 
     @Override
-    public List<OrdersVO> getOrderListByThirdOrderNo(String thirdOrderNo) {
-        return this.baseMapper.selectOrdersByThirdOrderNo(thirdOrderNo);
+    public List<OrdersVO> getOrderListByThirdTradeNo(String thirdTradeNo) {
+        return this.baseMapper.selectOrdersByThirdOrderNo(thirdTradeNo);
     }
 
     @Override

+ 3 - 4
pdf-office-payment/src/main/java/cn/kdan/cloud/pdf/office/payment/service/impl/PayCenterWebhookServiceImpl.java

@@ -50,7 +50,6 @@ import org.springframework.util.StreamUtils;
 import org.springframework.web.client.RestTemplate;
 
 import java.io.IOException;
-import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.time.ZoneId;
@@ -126,7 +125,7 @@ public class PayCenterWebhookServiceImpl implements PayCenterWebhookService {
             }
             // 处理回调
             // 根据第三方id获取订单
-            List<OrdersVO> ordersVOList = ordersService.getOrderListByThirdOrderNo(thirdTradeId);
+            List<OrdersVO> ordersVOList = ordersService.getOrderListByThirdTradeNo(thirdTradeId);
             if (CollectionUtils.isEmpty(ordersVOList)) {
                 log.error("根据第三方订单id查询不到订单信息,thirdTradeId:{}", thirdTradeId);
                 // 根据自定义订单号查询
@@ -199,8 +198,8 @@ public class PayCenterWebhookServiceImpl implements PayCenterWebhookService {
                     Order order = new Order();
                     order.setId(ordersVO.getId());
                     order.setSubscriptionId(subscription.getId());
-                    order.setThirdOrderNo(thirdTradeId);
-                    order.setThirdTradeNo(payId);
+                    order.setThirdOrderNo(payId);
+                    order.setThirdTradeNo(thirdTradeId);
                     order.setStatus(OrderConstant.COMPLETED);
                     order.setPayDate(new Date());
                     order.setInvoiceNo(MyDateUtils.getTimeStamp() + (int) ((Math.random() * 9 + 1) * 1000));

+ 1 - 1
pdf-office-payment/src/main/resources/mapper/OrderMapper.xml

@@ -100,7 +100,7 @@
              ,user_id
              ,email,pay_number,discount_type,subscription_type,payment_model
         from `order`
-        where third_order_no = #{thirdOrderNo}
+        where third_trade_no = #{thirdOrderNo}
     </select>
 
     <select id="getOrderByUser" resultType="cn.kdan.cloud.pdf.office.api.payment.vo.OrdersVO">