|
|
|
@ -67,7 +67,14 @@ public class OcrSimulatorController{
|
|
|
|
|
//执行识别
|
|
|
|
|
JSONObject semanticRequestBody = new JSONObject();
|
|
|
|
|
semanticRequestBody.put("task_id", time+"");
|
|
|
|
|
semanticRequestBody.put("img_path", uploadFilePath + "/" + image);
|
|
|
|
|
OcrIdentifyDetail ocrIdentifyDetail=new OcrIdentifyDetail();
|
|
|
|
|
if (image.contains("http:") || image.contains("https:")) {
|
|
|
|
|
semanticRequestBody.put("img_path",image);
|
|
|
|
|
ocrIdentifyDetail.setImageUrl(image);//图片地址
|
|
|
|
|
}else{
|
|
|
|
|
ocrIdentifyDetail.setImageUrl(uploadFilePath + "/" + image);//图片地址
|
|
|
|
|
semanticRequestBody.put("img_path", uploadFilePath + "/" + image);
|
|
|
|
|
}
|
|
|
|
|
JSONObject semanticResponseJson = RestUtil.post(OcrConstant.api_test2_identify_url, semanticRequestBody);
|
|
|
|
|
//执行时间 调整小数点
|
|
|
|
|
Double nluTime = semanticResponseJson.getDouble("nlu_time");
|
|
|
|
@ -75,12 +82,11 @@ public class OcrSimulatorController{
|
|
|
|
|
nluTime = nluTime != null && nluTime != 0 ? new BigDecimal(nluTime).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
|
|
|
|
|
ocrTime = ocrTime != null && ocrTime != 0 ? new BigDecimal(ocrTime).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() : 0;
|
|
|
|
|
//入库
|
|
|
|
|
OcrIdentifyDetail ocrIdentifyDetail=new OcrIdentifyDetail();
|
|
|
|
|
ocrIdentifyDetail.setIdentifyId(ocrIdentify.getId());
|
|
|
|
|
ocrIdentifyDetail.setOcrTime(ocrTime);
|
|
|
|
|
ocrIdentifyDetail.setNluTime(nluTime);
|
|
|
|
|
ocrIdentifyDetail.setImageName(image);//图片名称
|
|
|
|
|
ocrIdentifyDetail.setImageUrl(uploadFilePath + "/" + image);//图片地址
|
|
|
|
|
|
|
|
|
|
ocrIdentifyDetail.setSemanticResult(semanticResponseJson.toJSONString());//ocr识别结果
|
|
|
|
|
ocrIdentifyDetailList.add(ocrIdentifyDetail);
|
|
|
|
|
//累计时间
|
|
|
|
|