From 5c97997a69a5931abd4c6fc961dd45bcc2776781 Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Fri, 1 Sep 2023 10:04:20 +0800 Subject: [PATCH] updates --- .../ocr/service/impl/OcrIdentifyServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java index c48d509..ea3aa5a 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/service/impl/OcrIdentifyServiceImpl.java @@ -975,7 +975,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult); + if (semanticResult2!=null) { + List> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult2); if (resultToPoints.size() > 0) { ImageUtils.drawDashedRectangleOnImages(file.getAbsolutePath(), resultToPoints, outputImagePath); imgPath = outputImagePath; @@ -1009,6 +1009,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl checkSemanticModelMap = getCheckSemanticModelMap(ocrRuleCheckVo.getConfigRuleMap(), ocrRuleCheckVo.getFieldMap(), sourceJson); String text = null;//ocr 识别的文本 @@ -1022,7 +1023,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl fieldNameList = Arrays.asList(fieldName.split(",")); text = null; - boolean b = ArrayOUtils.containsStringList(fieldNameList, semanticResult.keySet().stream().collect(Collectors.toList())); + boolean b = ArrayOUtils.containsStringList(fieldNameList, semanticResult.getJSONObject("semantic_result").keySet().stream().collect(Collectors.toList())); //查看ocr识别返回的字段名称中是否有当前这个字段名称 if (b) { //TODO 注意,ocr 识别返回的 字段是多个结果(数组),有一个值匹配上即为正确