|
@@ -43,7 +43,6 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
try (Response response = super.getClient().newCall(request).execute()) {
|
|
|
ResponseBody respBody = response.body();
|
|
|
String respBodyStr = respBody != null ? respBody.string() : "";
|
|
|
- log.info(respBodyStr);
|
|
|
|
|
|
if (response.isSuccessful()) {
|
|
|
BaiduParseDocTaskResp resp = new ObjectMapper().readValue(respBodyStr, BaiduParseDocTaskResp.class);
|
|
@@ -52,11 +51,11 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- throw new StatusException(respBodyStr);
|
|
|
+ log.warn("responseCode:{} {}", response.code(), respBodyStr);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("Baidu parse doc error. {}", e.getMessage());
|
|
|
- throw new StatusException(e.getMessage(), e);
|
|
|
+ log.error("Baidu parseDocTask fail. {}", e.getMessage(), e);
|
|
|
}
|
|
|
+ throw new StatusException("请求文档解析任务失败");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -74,7 +73,6 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
try (Response response = super.getClient().newCall(request).execute()) {
|
|
|
ResponseBody respBody = response.body();
|
|
|
String respBodyStr = respBody != null ? respBody.string() : "";
|
|
|
- log.info(respBodyStr);
|
|
|
|
|
|
if (response.isSuccessful()) {
|
|
|
BaiduParseDocTaskQueryResp resp = new ObjectMapper().readValue(respBodyStr, BaiduParseDocTaskQueryResp.class);
|
|
@@ -93,11 +91,11 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- throw new StatusException(respBodyStr);
|
|
|
+ log.warn("responseCode:{} {}", response.code(), respBodyStr);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("Baidu parse doc query error. {}", e.getMessage());
|
|
|
- throw new StatusException(e.getMessage(), e);
|
|
|
+ log.error("Baidu parseDocTaskQuery fail. {}", e.getMessage(), e);
|
|
|
}
|
|
|
+ throw new StatusException("查询文档解析结果失败");
|
|
|
}
|
|
|
|
|
|
private Request buildRequest(String url, FormBody.Builder formBuilder) {
|
|
@@ -122,7 +120,7 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
config.setKey("xxx");
|
|
|
config.setSecret("xxx");
|
|
|
config.setQps(10);
|
|
|
- config.setSupplier("3@@baidu.doc.BaiduParseDocClient");
|
|
|
+ config.setSupplier("1@@baidu.doc.BaiduParseDocClient");
|
|
|
DocApiClient client = new BaiduParseDocClient(config);
|
|
|
|
|
|
|