ocr识别-同步至文档库修改

This commit is contained in:
liyawei
2022-02-24 10:56:15 +08:00
parent 2928270b3e
commit 7dd6c40ce8
@@ -89,14 +89,24 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@AutoLog(value = "OCR识别转换记录表-同步至文档库")
@ApiOperation(value="OCR识别转换记录表-同步至文档库", notes="OCR识别转换记录表-同步至文档库")
@GetMapping(value = "/syncToDocument")
@PostMapping(value = "/syncToDocument")
public Result<?> syncToDocument(@RequestBody OcrRecordEO ocrRecordEO) {
if(StringUtils.isBlank(ocrRecordEO.getAttId())){
return Result.error("没有可同步的文档");
}
if (StringUtils.isBlank(ocrRecordEO.getStandName())
|| StringUtils.isBlank(ocrRecordEO.getStandNumber())){
return Result.error("参数不能为空");
}
//通过编号和标题查询对应文档
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getTitle, ocrRecordEO.getStandName())
.eq(BussDocumentLibraryEO::getSerialNumber, ocrRecordEO.getStandNumber());
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(queryWrapper);
if(CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)){
if(StringUtils.isBlank(ocrRecordEO.getFileType())){
return Result.error("文本状态不也能为空");
}
OSSFile ossFile = new OSSFile();
//设置doc文件的关联id
if (FileTypeEnum.RELEASE_DRAFT.getValue().equals(ocrRecordEO.getFileType())){
@@ -109,8 +119,12 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
ossFile.setConnectId(bussDocumentLibraryEOList.get(0).getExposureDraft());
}
ossFile.setId(ocrRecordEO.getAttId());
ossFileService.updateById(ossFile);
return Result.OK();
boolean updateResult = ossFileService.updateById(ossFile);
if(updateResult){
return Result.OK("同步成功", ossFile);
}else{
return Result.error("同步失败");
}
}else{
return Result.error("没有可同步的文档");
}