From 3721d9e4c1f79b7b38d89db3a73c62135640be64 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 24 五月 2022 15:52:04 +0800
Subject: [PATCH] 优化代码

---
 service-acct/src/main/java/com/java110/acct/smo/impl/QrCodeAliPaymentAdapt.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/service-acct/src/main/java/com/java110/acct/smo/impl/QrCodeAliPaymentAdapt.java b/service-acct/src/main/java/com/java110/acct/smo/impl/QrCodeAliPaymentAdapt.java
index cacab44..40da16d 100644
--- a/service-acct/src/main/java/com/java110/acct/smo/impl/QrCodeAliPaymentAdapt.java
+++ b/service-acct/src/main/java/com/java110/acct/smo/impl/QrCodeAliPaymentAdapt.java
@@ -10,12 +10,12 @@
 import com.alipay.api.response.AlipayTradeQueryResponse;
 import com.java110.acct.smo.IQrCodePaymentSMO;
 import com.java110.core.factory.CommunitySettingFactory;
+import com.java110.core.log.LoggerFactory;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
-import com.java110.core.log.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 /**
@@ -84,16 +84,16 @@
         request.setBizContent(bizContent.toString());
         AlipayTradePayResponse response = alipayClient.execute(request);
         logger.debug("鏀粯瀹濊繑鍥�:" + JSONObject.toJSONString(response));
-        if (response.isSuccess()) {
+        if ("10000".equals(response.getCode()) && response.isSuccess()) {
             System.out.println("璋冪敤鎴愬姛");
         } else {
             System.out.println("璋冪敤澶辫触");
         }
 
-        if (response.isSuccess()) {
+        if ("10000".equals(response.getCode()) && response.isSuccess()) {
             return new ResultVo(ResultVo.CODE_OK, "鎴愬姛");
         } else {
-            return new ResultVo(ResultVo.CODE_ERROR, response.getSubMsg());
+            return new ResultVo(ResultVo.CODE_ERROR, StringUtil.isEmpty(response.getSubMsg())?"绛夊緟鐢ㄦ埛鏀粯":response.getSubMsg());
         }
     }
 
@@ -105,6 +105,9 @@
                 "json", "UTF-8",
                 CommunitySettingFactory.getRemark(communityId, "ALIPAY_PUBLIC_KEY"), "RSA2");
         AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
+        if (!StringUtil.isEmpty(CommunitySettingFactory.getValue(communityId, APP_AUTH_TOKEN))) {
+            request.putOtherTextParam("app_auth_token", CommunitySettingFactory.getValue(communityId, APP_AUTH_TOKEN));
+        }
         request.setBizContent("{" +
                 "  \"out_trade_no\":\"" + orderNum + "\"," +
                 "  \"trade_no\":\"\"," +
@@ -118,7 +121,7 @@
         } catch (AlipayApiException e) {
             return new ResultVo(ResultVo.CODE_ERROR, "鏌ヨ澶辫触" + e.getErrMsg());
         }
-
+        logger.debug("鏀粯瀹濊繑鍥�:" + JSONObject.toJSONString(response));
         if (!"10000".equals(response.getCode())) {
             return new ResultVo(ResultVo.CODE_ERROR, response.getMsg());
         }

--
Gitblit v1.8.0