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