|
@@ -114,12 +114,18 @@ public class WxApiService {
|
|
|
"</xml>";
|
|
|
String url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
|
|
|
String str = getRestTemplate().postForObject(url, xml, String.class);
|
|
|
+ log.info("微信统一下单返回:{}", str);
|
|
|
try {
|
|
|
assert str != null;
|
|
|
Document document = DocumentHelper.parseText(str);
|
|
|
Element root = document.getRootElement();
|
|
|
if (root.element("return_code").getStringValue().equals("SUCCESS")) {
|
|
|
TreeMap<String, String> back = new TreeMap<>();
|
|
|
+ if (null == root.element("prepay_id")) {
|
|
|
+ final String message = root.element("err_code_des").getStringValue();
|
|
|
+ log.info("微信统一下单失败:{}", message);
|
|
|
+ return CompletableFuture.completedFuture(ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, message));
|
|
|
+ }
|
|
|
String prepayId = root.element("prepay_id").getStringValue();
|
|
|
String timeStamp = Long.toString(System.currentTimeMillis());
|
|
|
back.put("appId", PropertiesUtil.getProperty("appId"));
|