|
|
|
@ -151,32 +151,32 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
//ocr识别参数为空,不通过
|
|
|
|
|
rMessage.append(value.getFieldName() + "参数未获取到结果<br>");
|
|
|
|
|
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() + "不匹配<br>");
|
|
|
|
|
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() + "参数未获取到结果<br>");
|
|
|
|
|
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() + "参数未获取到结果<br>");
|
|
|
|
|
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<OcrIdentifyMapper, OcrId
|
|
|
|
|
@Override
|
|
|
|
|
@Async
|
|
|
|
|
public void updateTaskResultInfo(String id){
|
|
|
|
|
/*OcrIdentifyVo ocrIdentifyVo = this.findById(id);
|
|
|
|
|
OcrIdentifyVo ocrIdentifyVo = this.findById(id);
|
|
|
|
|
List<OcrIdentifyDetail> 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<OcrIdentifyMapper, OcrId
|
|
|
|
|
//ocr识别参数为空,不通过
|
|
|
|
|
rMessage.append(value.getFieldName() + "_参数未获取到结果<br>");
|
|
|
|
|
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() + "_参数不匹配<br>");
|
|
|
|
|
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() + "_参数未获取到结果<br>");
|
|
|
|
|
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() + "_参数未获取到结果<br>");
|
|
|
|
|
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<OcrIdentifyMapper, OcrId
|
|
|
|
|
* @param imgPath
|
|
|
|
|
* @param failureReason
|
|
|
|
|
*/
|
|
|
|
|
public static void ocrResultAdd(List<OcrResult> ocrResultList, String field, String inputText, String ocrText, Double ocrPrecisionRate, String imgPath, String failureReason, Boolean ruleValidation) {
|
|
|
|
|
public static void ocrResultAdd(List<OcrResult> 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);
|
|
|
|
|