|
@@ -146,26 +146,26 @@ public class ResumeController extends BaseController
|
|
|
} else if (suffix.equals(".docx")) {
|
|
|
content = FileUtils.readWordDocx(fileUrl);
|
|
|
}else if (TYPE_LIST.contains(suffix)){
|
|
|
-// String encodeToString = Base64Utils.encodeToString(file.getBytes());
|
|
|
-// RestTemplate restTemplate = new RestTemplate();
|
|
|
-// Map<String,Object> map = new HashMap<>();
|
|
|
-// map.put("base64",encodeToString);
|
|
|
-// Map<String,Object> options = new HashMap<>();
|
|
|
-// options.put("tbpu.parser","single_line");
|
|
|
-// options.put("data.format","text");
|
|
|
-// options.put("ocr.angle",false);
|
|
|
-// options.put("ocr.language","简体中文");
|
|
|
-// options.put("ocr.maxSideLen",1024);
|
|
|
-// map.put("options",options);
|
|
|
-// ResponseEntity<String> responseEntity = restTemplate.postForEntity(
|
|
|
-// "http://127.0.0.1:1224/api/ocr", map, String.class);
|
|
|
-// JSONObject parse = JSONObject.parse(responseEntity.getBody());
|
|
|
-// if (100 != parse.getInteger("code")) {
|
|
|
-// return AjaxResult.error("文件不存在解析失败");
|
|
|
-// }
|
|
|
-// content=new ArrayList<>();
|
|
|
-// String[] split = parse.getString("data").split("\n");
|
|
|
-// content.addAll(Arrays.asList(split));
|
|
|
+ String encodeToString = Base64Utils.encodeToString(file.getBytes());
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("base64",encodeToString);
|
|
|
+ Map<String,Object> options = new HashMap<>();
|
|
|
+ options.put("tbpu.parser","single_line");
|
|
|
+ options.put("data.format","text");
|
|
|
+ options.put("ocr.angle",false);
|
|
|
+ options.put("ocr.language","简体中文");
|
|
|
+ options.put("ocr.maxSideLen",1024);
|
|
|
+ map.put("options",options);
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.postForEntity(
|
|
|
+ "http://127.0.0.1:1224/api/ocr", map, String.class);
|
|
|
+ JSONObject parse = JSONObject.parse(responseEntity.getBody());
|
|
|
+ if (100 != parse.getInteger("code")) {
|
|
|
+ return AjaxResult.error("文件不存在解析失败");
|
|
|
+ }
|
|
|
+ content=new ArrayList<>();
|
|
|
+ String[] split = parse.getString("data").split("\n");
|
|
|
+ content.addAll(Arrays.asList(split));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
return AjaxResult.error("文件不存在解析失败");
|