master
周文涛 2 years ago
parent ee6b061f8e
commit 801c6f2dbc

@ -142,7 +142,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
ocrIdentifyDetail.setStatus("");
ocrIdentifyDetail.setMessage(message);
ocrIdentifyDetail.setExecutionTime(executionTime / 1000);
ocrIdentifyDetail.setSemanticResult(semanticResult.toJSONString());
ocrIdentifyDetail.setSemanticResult(semanticResult.getJSONObject("semantic_result").toJSONString());
ocrIdentifyDetailService.save(ocrIdentifyDetail);
}
//===================
@ -165,13 +165,13 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
String inputText = value.getInputText();//校验文本 ocr识别的文本如果不包含该内容则算作失败
List<String> 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 识别返回的 字段是多个结果(数组),有一个值匹配上即为正确
List<JSONObject> ocrArray = new ArrayList<>();
for (String s : fieldNameList) {
JSONArray jsonArray = semanticResult.getJSONArray(s);
JSONArray jsonArray = semanticResult.getJSONObject("semantic_result").getJSONArray(s);
if (jsonArray != null && jsonArray.size() > 0) {
ocrArray.addAll(jsonArray.toJavaList(JSONObject.class));
}

Loading…
Cancel
Save