|
@@ -288,7 +288,7 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
outputStream.flush();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
if(outputStream!=null){
|
|
|
try {
|
|
|
outputStream.close();
|
|
@@ -806,9 +806,8 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
* */
|
|
|
private Map<String, String> jsapiPay(Integer storeId, Map<String, String> reqData, String ip, String platform) {
|
|
|
try {
|
|
|
- logger.info("调用微信支付下单接口入参{}", JsonUtil.toJSONString(reqData));
|
|
|
- logger.info("请求平台:{}", platform);
|
|
|
- // 支付配置
|
|
|
+ logger.info("调用微信支付下单接口入参:{},请求平台:{}", JsonUtil.toJSONString(reqData), platform);
|
|
|
+ // 获取支付配置
|
|
|
getApiConfig(storeId, platform);
|
|
|
WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig();
|
|
|
Map<String, String> params = UnifiedOrderModel
|
|
@@ -828,7 +827,7 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
.createSign(wxPayApiConfig.getPartnerKey(), SignType.MD5);
|
|
|
String xmlResult = WxPayApi.pushOrder(false, params);
|
|
|
|
|
|
- logger.info(xmlResult);
|
|
|
+ logger.info("调用微信支付下单接口返回xml:{}", xmlResult);
|
|
|
Map<String, String> result = WxPayKit.xmlToMap(xmlResult);
|
|
|
|
|
|
String returnCode = result.get("return_code");
|
|
@@ -841,7 +840,7 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
logger.error(returnMsg);
|
|
|
}
|
|
|
|
|
|
- logger.info("调用微信支付下单接口返回{}", JsonUtil.toJSONString(result));
|
|
|
+ logger.info("调用微信支付下单接口返回数据:{}", JsonUtil.toJSONString(result));
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
@@ -860,8 +859,7 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
* */
|
|
|
private Map<String, String> wapPay(Integer storeId, Map<String, String> reqData, String ip, String platform) {
|
|
|
try {
|
|
|
- logger.info("调用微信h5支付下单接口入参{}", JsonUtil.toJSONString(reqData));
|
|
|
- logger.info("请求平台:{}", platform);
|
|
|
+ logger.info("调用微信h5支付下单接口入参{},请求平台:{}", JsonUtil.toJSONString(reqData), platform);
|
|
|
// 支付配置
|
|
|
getApiConfig(storeId, platform);
|
|
|
WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig();
|
|
@@ -903,7 +901,7 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
throw new RuntimeException(return_msg);
|
|
|
}
|
|
|
result.put("backUrl", env.getProperty("website.url"));
|
|
|
- logger.info("调用微信h5支付接口返回{}", JsonUtil.toJSONString(result));
|
|
|
+ logger.info("调用微信h5支付接口返回数据:{}", JsonUtil.toJSONString(result));
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
@@ -925,14 +923,20 @@ public class WeixinServiceImpl implements WeixinService {
|
|
|
String mchId = wxPayBean.getMchId();
|
|
|
String apiV2 = wxPayBean.getApiV2();
|
|
|
String certPath = wxPayBean.getCertPath();
|
|
|
+ String appId = wxPayBean.getAppId();
|
|
|
+ logger.info("微信支付店铺信息:{}", JsonUtil.toJSONString(mtStore));
|
|
|
if (mtStore != null && StringUtil.isNotEmpty(mtStore.getWxApiV2()) && StringUtil.isNotEmpty(mtStore.getWxMchId())) {
|
|
|
mchId = mtStore.getWxMchId();
|
|
|
apiV2 = mtStore.getWxApiV2();
|
|
|
String basePath = env.getProperty("images.root");
|
|
|
certPath = basePath + mtStore.getWxCertPath();
|
|
|
+ MtMerchant mtMerchant = merchantService.queryMerchantById(mtStore.getMerchantId());
|
|
|
+ if (mtMerchant != null && StringUtil.isNotEmpty(mtMerchant.getWxAppId())) {
|
|
|
+ appId = mtMerchant.getWxAppId();
|
|
|
+ }
|
|
|
}
|
|
|
apiConfig = WxPayApiConfig.builder()
|
|
|
- .appId(wxPayBean.getAppId())
|
|
|
+ .appId(appId)
|
|
|
.mchId(mchId)
|
|
|
.partnerKey(apiV2)
|
|
|
.certPath(certPath)
|