parent
f0d00c730f
commit
7ee125c479
|
|
@ -22,8 +22,8 @@ public class FileController {
|
|||
|
||||
@Resource
|
||||
FileSourceService fileSourceService;
|
||||
@Resource
|
||||
OcrService ocrService;
|
||||
// @Resource
|
||||
// OcrService ocrService;
|
||||
|
||||
/**
|
||||
* todo
|
||||
|
|
@ -33,18 +33,18 @@ public class FileController {
|
|||
public AjaxResult uploadFile(@RequestParam(value = "file") MultipartFile file,
|
||||
@RequestParam(value = "ocrType", required = false) String ocrType) {
|
||||
FileSourceVo vo = BeanUtil.copyProperties(fileSourceService.addFile(file, "ip"), FileSourceVo.class);
|
||||
if (StrUtil.isNotEmpty(ocrType)) {
|
||||
OcrDTO ocr = new OcrDTO();
|
||||
OcrTypeEnum ocrTypeEnum = OcrTypeEnum.findByCode(ocrType);
|
||||
if (ocrTypeEnum != OcrTypeEnum.NONE) {
|
||||
ocr.setOcrType(ocrTypeEnum);
|
||||
ocr.setImgPath(vo.getFilePath());
|
||||
Result<JSONObject> ocrInfo = ocrService.ocr(ocr);
|
||||
if (ocrInfo.isSuccess()) {
|
||||
vo.setOcr(ocrInfo.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (StrUtil.isNotEmpty(ocrType)) {
|
||||
// OcrDTO ocr = new OcrDTO();
|
||||
// OcrTypeEnum ocrTypeEnum = OcrTypeEnum.findByCode(ocrType);
|
||||
// if (ocrTypeEnum != OcrTypeEnum.NONE) {
|
||||
// ocr.setOcrType(ocrTypeEnum);
|
||||
// ocr.setImgPath(vo.getFilePath());
|
||||
//// Result<JSONObject> ocrInfo = ocrService.ocr(ocr);
|
||||
//// if (ocrInfo.isSuccess()) {
|
||||
//// vo.setOcr(ocrInfo.getData());
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue