diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult.java index d0890c2..f13d2ff 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult.java @@ -10,8 +10,10 @@ import lombok.Data; */ @Data public class OcrResult { - @ApiModelProperty(value = "检索字段名称") + @ApiModelProperty(value = "检索字段") private String tag; + @ApiModelProperty(value = "检索字段名称") + private String tagName; @ApiModelProperty(value = "api输入值") private String inputText; @ApiModelProperty(value = "ocr识别文本") diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult2.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult2.java index 176d084..92cdde5 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult2.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/model/OcrResult2.java @@ -10,8 +10,10 @@ import lombok.Data; */ @Data public class OcrResult2 { - @ApiModelProperty(value = "检索字段名称") + @ApiModelProperty(value = "字段") private String tag; + @ApiModelProperty(value = "字段名称") + private String tagName; /*@ApiModelProperty(value = "api输入值") private String inputText; @ApiModelProperty(value = "ocr识别文本") 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 87a8c4e..93fad51 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 @@ -151,32 +151,32 @@ public class OcrIdentifyServiceImpl extends ServiceImpl"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "参数未获取到结果", false); + ocrResultAdd(ocrResultList, field,value.getFieldName(), inputText, text, probability, imgPath, value.getFieldName() + "参数未获取到结果", false); } else if ("1".equals(ruleInfo) && StringUtils.isNotBlank(text)) { //不必校验,有值就行,通过 fieldRightMap.put(field, true); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, "", true); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, "", true); } else if ("0".equals(ruleInfo)) { //必定验证参数,必须有值且匹配 if (StringUtils.isBlank(inputText) || text.contains(inputText)) { fieldRightMap.put(field, true); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, "", true); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, "", true); } else { rMessage.append(value.getFieldName() + "不匹配
"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "不匹配", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "不匹配", false); } } } }else{ rMessage.append(value.getFieldName() + "参数未获取到结果
"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "参数未获取到结果", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数未获取到结果", false); } } else { rMessage.append(value.getFieldName() + "参数未获取到结果
"); - ocrResultAdd(ocrResultList, field, inputText, null, 0d, imgPath, value.getFieldName() + "参数未获取到结果", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, null, 0d, imgPath, value.getFieldName() + "参数未获取到结果", false); fieldRightMap.put(field, false); } } @@ -289,9 +289,9 @@ public class OcrIdentifyServiceImpl extends ServiceImpl identifyDetails = ocrIdentifyDetailService.listByIdentifyId(ocrIdentifyVo.getId()); - for (OcrIdentifyDetail identifyDetail : identifyDetails) { + /*for (OcrIdentifyDetail identifyDetail : identifyDetails) { JSONObject semanticResult = JSONObject.parseObject(identifyDetail.getSemanticResult()); String imgPath = identifyDetail.getImageUrl(); // 进行数据化 结构 @@ -336,32 +336,32 @@ public class OcrIdentifyServiceImpl extends ServiceImpl"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "_参数未获取到结果", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "_参数未获取到结果", false); } else if ("1".equals(ruleInfo) && StringUtils.isNotBlank(text)) { //不必校验,有值就行,通过 fieldRightMap.put(field, true); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, "", true); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, "", true); } else if ("0".equals(ruleInfo)) { //必定验证参数,必须有值且匹配 if (StringUtils.isBlank(inputText) || text.contains(inputText)) { fieldRightMap.put(field, true); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, "", true); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, "", true); } else { rMessage.append(value.getFieldName() + "_参数不匹配
"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "_参数不匹配", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "_参数不匹配", false); } } } }else{ rMessage.append(value.getFieldName() + "_参数未获取到结果
"); mapPutIfTrue(fieldRightMap, field, false); - ocrResultAdd(ocrResultList, field, inputText, text, probability, imgPath, value.getFieldName() + "_参数未获取到结果", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "_参数未获取到结果", false); } } else { rMessage.append(value.getFieldName() + "_参数未获取到结果
"); - ocrResultAdd(ocrResultList, field, inputText, null, 0d, imgPath, value.getFieldName() + "_参数未获取到结果", false); + ocrResultAdd(ocrResultList,value.getFieldName(), field, inputText, null, 0d, imgPath, value.getFieldName() + "_参数未获取到结果", false); fieldRightMap.put(field, false); } } @@ -522,9 +522,10 @@ public class OcrIdentifyServiceImpl extends ServiceImpl ocrResultList, String field, String inputText, String ocrText, Double ocrPrecisionRate, String imgPath, String failureReason, Boolean ruleValidation) { + public static void ocrResultAdd(List ocrResultList,String fieldName, String field, String inputText, String ocrText, Double ocrPrecisionRate, String imgPath, String failureReason, Boolean ruleValidation) { OcrResult ocrResult = new OcrResult(); ocrResult.setTag(field); + ocrResult.setTagName(fieldName); ocrResult.setOcrText(ocrText); ocrResult.setInputText(inputText); ocrResult.setOcrPrecisionRate(ocrPrecisionRate == null ? 0d : ocrPrecisionRate);