master
周文涛 2 years ago
parent 1157cd3835
commit d5589df394

@ -255,6 +255,34 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
if (ocrIdentify == null) { if (ocrIdentify == null) {
return Result.error("未找到对应数据"); return Result.error("未找到对应数据");
} }
Map<String, OcrRuleCheckVo> ocrRuleCheckMap = ocrRuleCheckService.listToMap(null);
Map<String, OcrMetadataConfigVo> metadataConfigMap = ocrMetadataConfigService.listToMap(null);
Map<String, String> taskNameMap = ocrTaskTypeService.listNameToMap(null);
List<OcrIdentifyDetail> ocrIdentifyDetailList = null;
ocrIdentifyDetailList = ocrIdentifyDetailService.list(new LambdaQueryWrapper<OcrIdentifyDetail>().eq(OcrIdentifyDetail::getIdentifyId, id));
List<OcrIdentifyDetail> identifyDetailList = new ArrayList<>();
if ("1".equals(ocrIdentify.getStatus()) &&ocrIdentifyDetailList!=null&&ocrIdentifyDetailList.size()>0) {
//判断明细是否识别成功
identifyDetailList = ocrIdentifyDetailList.stream().filter(o -> o.getIdentifyId().equals(ocrIdentify.getId())).collect(Collectors.toList());
if (identifyDetailList.size()>0) {
long errorCount = identifyDetailList.stream().filter(i -> i.getStatus().equals("1")).count();
//errorCount>0,说明有失败的明细
ocrIdentify.setTaskResult(errorCount>0?"0":"1");
}else{
//失败
ocrIdentify.setTaskResult("0");
}
}
OcrRuleCheckVo ocrRuleCheckVo = ocrRuleCheckMap.get(ocrIdentify.getRuleCheck());
if (ocrRuleCheckVo!=null && StringUtils.isNotBlank(ocrRuleCheckVo.getMetadataConfigId())) {
ocrIdentify.setMetadataConfigId(ocrRuleCheckVo.getMetadataConfigId());
OcrMetadataConfigVo ocrMetadataConfigVo = metadataConfigMap.get(ocrRuleCheckVo.getMetadataConfigId());
if (ocrMetadataConfigVo!=null) {
ocrIdentify.setTaskType(ocrMetadataConfigVo.getTaskType());
ocrIdentify.setTaskType_dictText(taskNameMap.get(ocrMetadataConfigVo.getTaskType()));
}
}
return Result.OK(ocrIdentify); return Result.OK(ocrIdentify);
} }

Loading…
Cancel
Save