|
@@ -529,6 +529,27 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
return responseString;
|
|
return responseString;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
|
|
+ public static String queryTrace(String waybillToken) {
|
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
|
+ json.put("waybill_token",waybillToken);
|
|
|
|
|
+ AccessToken accessToken = AccessTokenApi.getAccessToken(WxConstants.APPLET_APPID, WxConstants.APPLET_SECRET);
|
|
|
|
|
+ String url = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_trace?access_token=" + accessToken.getToken();
|
|
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
|
|
+ HttpPost httpPost = new HttpPost(url);
|
|
|
|
|
+ httpPost.addHeader("Content-Type", "application/json");
|
|
|
|
|
+ StringEntity requestBody = new StringEntity(json.toString(), ContentType.APPLICATION_JSON.withCharset("UTF-8"));
|
|
|
|
|
+ httpPost.setEntity(requestBody);
|
|
|
|
|
+ CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
|
|
+ HttpEntity responseEntity = response.getEntity();
|
|
|
|
|
+ String responseString = EntityUtils.toString(responseEntity, "UTF-8");
|
|
|
|
|
+ log.info(responseString);
|
|
|
|
|
+ response.close();
|
|
|
|
|
+ httpClient.close();
|
|
|
|
|
+ return responseString;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
}
|
|
}
|