|
|
|
@ -206,7 +206,7 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
DateTime dateTime = timedCache.get(join);
|
|
|
|
|
return DateUtil.between(dateTime, DateUtil.date(), DateUnit.SECOND) > fileIdList.size() * 10L;
|
|
|
|
|
return DateUtil.between(dateTime, DateUtil.date(), DateUnit.SECOND) > fileIdList.size() * 15L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -277,24 +277,27 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
private List<RecordFileDTO> waitingOCRFinish(List<String> fileIdList, int timeout){
|
|
|
|
|
|
|
|
|
|
DateTime date = DateUtil.date();
|
|
|
|
|
|
|
|
|
|
while (true){
|
|
|
|
|
List<RecordFileDTO> recordFileDTOS = ocrProcessService.queryFileListWithIdSort(fileIdList);
|
|
|
|
|
List<RecordFileDTO> recordFileDTOS = ocrProcessService.queryFileListWithIdSortNoTransaction(fileIdList);
|
|
|
|
|
boolean match = recordFileDTOS.stream().allMatch(recordFileDTO ->
|
|
|
|
|
StrUtil.equals(recordFileDTO.getOcrStatus(), OcrStatusEnum.FAIL.getCode())
|
|
|
|
|
|| StrUtil.equals(recordFileDTO.getOcrStatus(), OcrStatusEnum.SUCCESS.getCode()));
|
|
|
|
|
if (match){
|
|
|
|
|
log.info("waitingOCRFinish:文件id:{} 识别完成", StrUtil.join(",", fileIdList));
|
|
|
|
|
return recordFileDTOS;
|
|
|
|
|
}
|
|
|
|
|
log.info("waitingOCRFinish:等待文件id:{} 识别完成中...", StrUtil.join(",", fileIdList));
|
|
|
|
|
if (DateUtil.between(date, DateUtil.date(), DateUnit.SECOND) > timeout){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(3000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DateUtil.between(date, DateUtil.date(), DateUnit.SECOND) > timeout){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|