zouxuan 1 год назад
Родитель
Сommit
5f4dc11c6e

+ 8 - 6
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java

@@ -161,12 +161,7 @@ public class PaymentController extends BaseController {
         try {
             String content = request.getParameter("response");
             log.info("易宝支付回调信息:content:{}", content);
-            JSONObject dataObj = JSON.parseObject(content);
-            String orderNo = dataObj.getString("orderId");
-            UserOrderPayment userOrderPayment = userOrderPaymentService.getByAdapayNo(orderNo);
-            if (userOrderPayment == null) {
-                throw new BizException("订单不存在");
-            }
+
             HfMerchantConfig hfMerchantConfig = webFeignService.queryByTenantId("YEEPAY",tenantId).getData();
             if(hfMerchantConfig == null){
                 throw new BizException("机构[{}][{}]商户信息找不到", tenantId, "YEEPAY");
@@ -181,6 +176,13 @@ public class PaymentController extends BaseController {
             dto = DigitalEnvelopeUtils.decrypt(dto, privateKey, publicKey);
 
             log.info("易宝支付回调信息:plaintText:{}", dto.getPlainText());
+            JSONObject dataObj = JSON.parseObject(dto.getPlainText());
+
+            String orderNo = dataObj.getString("orderId");
+            UserOrderPayment userOrderPayment = userOrderPaymentService.getByAdapayNo(orderNo);
+            if (userOrderPayment == null) {
+                throw new BizException("订单不存在");
+            }
             if("SUCCESS".equals(dataObj.getString("status"))) {
                 orderService.paymentSucceededHandle(orderNo,
                         dataObj.getBigDecimal("orderAmount"),dataObj.getString("channel"));