master
周文涛 2 years ago
parent 04cc2a204d
commit 6d6ae664ef

@ -98,7 +98,8 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
}
String message = responseBody.getString("message");//描述
String taskStatus = responseBody.getString("taskStatus");//任务是否完成
Double executionTime = responseBody.getDouble("execution_time");//执行时长(秒)
Double ocrTime = responseBody.getDouble("ocr_time");//OCR识别时长
Double nluTime = responseBody.getDouble("nlu_time");//NLU执行时长
JSONObject semanticResult = responseBody.getJSONObject("semantic_result");//语义化结果
// 入库记录
OcrIdentifyDetail ocrIdentifyDetail = new OcrIdentifyDetail();
@ -144,11 +145,13 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//ocrIdentifyDetail.setStatus(taskStatus);
ocrIdentifyDetail.setStatus("");
ocrIdentifyDetail.setMessage(message);
ocrIdentifyDetail.setExecutionTime(executionTime / 1000);
ocrIdentifyDetail.setOcrTime(new BigDecimal(ocrTime).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
ocrIdentifyDetail.setNluTime(new BigDecimal(nluTime).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
ocrIdentifyDetail.setSemanticResult(semanticResult.getJSONObject("semantic_result").toJSONString());
ocrIdentifyDetailService.save(ocrIdentifyDetail);
}
//===================
Date startTime=new Date();
if (semanticResult != null) {
OcrIdentifyDTO ocrIdentifyDTO = this.findById(identifyId);
OcrRuleCheckDTO ocrRuleCheckVo = ocrIdentifyDTO.getOcrRuleCheckVo();
@ -271,6 +274,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
ocrIdentifyDetail.setMessage(rMessage.toString());
}
ocrIdentifyDetail.setDataStructured(JSONArray.toJSONString(ocrResultDTOList));//数据结构化
ocrIdentifyDetail.setExecutionTime((double)((new Date().getTime()-startTime.getTime())/1000));
ocrIdentifyDetailService.updateById(ocrIdentifyDetail);
}
//=========================

Loading…
Cancel
Save