|
@@ -48,7 +48,7 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
if (response.isSuccessful()) {
|
|
|
BaiduParseDocTaskResp resp = new ObjectMapper().readValue(respBodyStr, BaiduParseDocTaskResp.class);
|
|
|
if (resp.getErrorCode() == 0) {
|
|
|
- return new ParseDocTask(resp.getResult().getTaskId());
|
|
|
+ return new ParseDocTask(encodeTaskId(resp.getResult().getTaskId()));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -64,6 +64,7 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
if (getQueryRateLimiter() != null && !getQueryRateLimiter().acquire()) {
|
|
|
throw new DocRateLimitExceeded(getConfig().getQps());
|
|
|
}
|
|
|
+ taskId = decodeTaskId(taskId)[2];
|
|
|
|
|
|
FormBody.Builder formBuilder = new FormBody.Builder();
|
|
|
formBuilder.add("task_id", taskId);
|
|
@@ -121,14 +122,14 @@ public class BaiduParseDocClient extends DocApiClient {
|
|
|
config.setKey("xxx");
|
|
|
config.setSecret("xxx");
|
|
|
config.setQps(10);
|
|
|
- config.setSupplier("3");
|
|
|
+ config.setSupplier("3@@baidu.doc.BaiduParseDocClient");
|
|
|
DocApiClient client = new BaiduParseDocClient(config);
|
|
|
|
|
|
// File file = new File("D:\\home\\大纲.pdf");
|
|
|
// byte[] fileData = ByteArray.fromFile(file).value();
|
|
|
// System.out.println(client.parseDocTask(fileData, file.getName()).getTaskId());
|
|
|
|
|
|
- ParseDocTaskResult result = client.parseDocTaskQuery("task-rmebOA853Uk592w9uTOLqV8Wtffb3HhR");
|
|
|
+ ParseDocTaskResult result = client.parseDocTaskQuery("M0BAYmFpZHUuZG9jLkJhaWR1UGFyc2VEb2NDbGllbnRAQHRhc2stdnVrV1RHZnNSbFNJdDFBaDNsRUxqNzRRczJzdXNhOXk=");
|
|
|
System.out.println(result.getStatus());
|
|
|
System.out.println(result.getContent());
|
|
|
}
|