diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/controller/OcrRecordEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/controller/OcrRecordEOController.java index 179d1b29d..e506e9d8c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/controller/OcrRecordEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/controller/OcrRecordEOController.java @@ -66,6 +66,7 @@ public class OcrRecordEOController extends JeroController page = new Page(ocrRecordEOPage.getPageNo(), ocrRecordEOPage.getPageSize()); IPage pageList = ocrRecordService.page(page, queryWrapper); @@ -92,86 +93,87 @@ public class OcrRecordEOController extends JeroController queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(BussDocumentLibraryEO::getTitle, ocrRecordEO.getStandName()) .eq(BussDocumentLibraryEO::getSerialNumber, ocrRecordEO.getStandNumber()); List bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(queryWrapper); if(CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)){ - if(StringUtils.isBlank(ocrRecordEO.getFileType())){ - return Result.error("文本状态不也能为空"); - } - OSSFile ossFile = new OSSFile(); //查询doc文件的id LambdaQueryWrapper ossFileLambdaQueryWrapper = new LambdaQueryWrapper<>(); - ossFileLambdaQueryWrapper.eq(OSSFile :: getUrl, ocrRecordEO.getDocName()); + ossFileLambdaQueryWrapper.eq(OSSFile::getUrl, ocrRecordEO.getDocName()); List ossFiles = ossFileService.list(ossFileLambdaQueryWrapper); - if(CollectionUtil.isEmpty(ossFiles)){ - return Result.error("没有可同步的文档"); + if (CollectionUtil.isEmpty(ossFiles)) { + return Result.error("没有可同步的文件"); } - String docFileId = ossFiles.get(0).getId(); - ossFile.setId(docFileId); - //设置doc文件的关联id - if (FileTypeEnum.RELEASE_DRAFT.getValue().equals(ocrRecordEO.getFileType())){ - String connectId = bussDocumentLibraryEOList.get(0).getReleaseDraft(); - if(StringUtils.isBlank(connectId)){ - connectId = UUID.randomUUID().toString().replace("-",""); - //修改文档库相关字段 - BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); - bussDocumentLibraryEO.setId(bussDocumentLibraryEOList.get(0).getId()); - bussDocumentLibraryEO.setReleaseDraft(connectId); - bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); - } - ossFile.setConnectId(connectId); + //开始同步 + int countSuccess = 0; + for(BussDocumentLibraryEO documentLibraryEO : bussDocumentLibraryEOList) { + OSSFile ossFile = new OSSFile(); + String docFileId = ossFiles.get(0).getId(); + ossFile.setId(docFileId); + //设置doc文件的关联id + if (FileTypeEnum.RELEASE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) { + String connectId = documentLibraryEO.getReleaseDraft(); + if (StringUtils.isBlank(connectId)) { + connectId = UUID.randomUUID().toString().replace("-", ""); + //修改文档库相关字段 + BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); + bussDocumentLibraryEO.setId(documentLibraryEO.getId()); + bussDocumentLibraryEO.setReleaseDraft(connectId); + bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); + } + ossFile.setConnectId(connectId); - }else if (FileTypeEnum.SUPPLEMENT.getValue().equals(ocrRecordEO.getFileType())){ - String connectId = bussDocumentLibraryEOList.get(0).getSupplement(); - if(StringUtils.isBlank(connectId)){ - connectId = UUID.randomUUID().toString().replace("-",""); - //修改文档库相关字段 - BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); - bussDocumentLibraryEO.setId(bussDocumentLibraryEOList.get(0).getId()); - bussDocumentLibraryEO.setSupplement(connectId); - bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); - } - ossFile.setConnectId(connectId); + } else if (FileTypeEnum.SUPPLEMENT.getValue().equals(ocrRecordEO.getFileType())) { + String connectId = documentLibraryEO.getSupplement(); + if (StringUtils.isBlank(connectId)) { + connectId = UUID.randomUUID().toString().replace("-", ""); + //修改文档库相关字段 + BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); + bussDocumentLibraryEO.setId(documentLibraryEO.getId()); + bussDocumentLibraryEO.setSupplement(connectId); + bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); + } + ossFile.setConnectId(connectId); - }else if (FileTypeEnum.APPROVAL_DRAFT.getValue().equals(ocrRecordEO.getFileType())){ - String connectId = bussDocumentLibraryEOList.get(0).getApprovalDraft(); - if(StringUtils.isBlank(connectId)){ - connectId = UUID.randomUUID().toString().replace("-",""); - //修改文档库相关字段 - BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); - bussDocumentLibraryEO.setId(bussDocumentLibraryEOList.get(0).getId()); - bussDocumentLibraryEO.setApprovalDraft(connectId); - bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); - } - ossFile.setConnectId(connectId); + } else if (FileTypeEnum.APPROVAL_DRAFT.getValue().equals(ocrRecordEO.getFileType())) { + String connectId = documentLibraryEO.getApprovalDraft(); + if (StringUtils.isBlank(connectId)) { + connectId = UUID.randomUUID().toString().replace("-", ""); + //修改文档库相关字段 + BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); + bussDocumentLibraryEO.setId(documentLibraryEO.getId()); + bussDocumentLibraryEO.setApprovalDraft(connectId); + bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); + } + ossFile.setConnectId(connectId); - }else if (FileTypeEnum.EXPOSURE_DRAFT.getValue().equals(ocrRecordEO.getFileType())){ - String connectId = bussDocumentLibraryEOList.get(0).getExposureDraft(); - if(StringUtils.isBlank(connectId)){ - connectId = UUID.randomUUID().toString().replace("-",""); - //修改文档库相关字段 - BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); - bussDocumentLibraryEO.setId(bussDocumentLibraryEOList.get(0).getId()); - bussDocumentLibraryEO.setExposureDraft(connectId); - bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); - } - ossFile.setConnectId(connectId); + } else if (FileTypeEnum.EXPOSURE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) { + String connectId = documentLibraryEO.getExposureDraft(); + if (StringUtils.isBlank(connectId)) { + connectId = UUID.randomUUID().toString().replace("-", ""); + //修改文档库相关字段 + BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO(); + bussDocumentLibraryEO.setId(documentLibraryEO.getId()); + bussDocumentLibraryEO.setExposureDraft(connectId); + bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO); + } + ossFile.setConnectId(connectId); - } - boolean updateResult = ossFileService.updateById(ossFile); - //修改记录表的同步情况 - OcrRecordEO updateOcrRecordEO = new OcrRecordEO(); - updateOcrRecordEO.setId(ocrRecordEO.getId()); - updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue()); - ocrRecordService.editById(updateOcrRecordEO); - if(updateResult){ - return Result.OK("同步成功", ossFile); - }else{ - return Result.error("同步失败"); - } + } + ossFileService.updateById(ossFile); + //修改记录表的同步情况 + OcrRecordEO updateOcrRecordEO = new OcrRecordEO(); + updateOcrRecordEO.setId(ocrRecordEO.getId()); + updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue()); + ocrRecordService.editById(updateOcrRecordEO); + countSuccess++; + } + return Result.OK("同步成功", countSuccess); }else{ return Result.error("没有可同步的文档"); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/page/OcrRecordEOPage.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/page/OcrRecordEOPage.java index ad56e6cba..6e77035ec 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/page/OcrRecordEOPage.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ocr/page/OcrRecordEOPage.java @@ -1,14 +1,6 @@ package com.jero.modules.ocr.page; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.jero.common.aspect.annotation.Dict; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; /** * @Author: liyawei @@ -78,6 +70,11 @@ public class OcrRecordEOPage { private String jsonRealFile; + //分页 private Integer pageNo; private Integer pageSize; + + //排序 + private String orderBy; + private String orderByField; }