|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
|
|
import org.jeecg.common.constant.OcrConstant;
|
|
|
|
@ -749,6 +750,9 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
ocrResultDTO.setRuleValidationText("名称必须与参数完全一致");
|
|
|
|
|
}else if("101".equals(ruleValidationValue)){
|
|
|
|
|
ocrResultDTO.setRuleValidationText("有值必须匹配无值算过");
|
|
|
|
|
if (StringUtils.isBlank(ocrResultDTO.getOcrText())) {
|
|
|
|
|
ocrResultDTO.setRuleValidation(true);
|
|
|
|
|
}
|
|
|
|
|
}else if("isrule=1".equals(ruleValidationValue)){
|
|
|
|
|
ocrResultDTO.setRuleValidationText("依据输入参数必须一致判断");
|
|
|
|
|
}
|
|
|
|
@ -1066,9 +1070,13 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
|
|
|
|
|
JSONObject responseBody=new JSONObject();
|
|
|
|
|
//获取最小
|
|
|
|
|
Double min = ocrResultDTOList.stream().sorted((a, b) -> a.getTextRate().compareTo(b.getTextRate())).findFirst().get().getTextRate();
|
|
|
|
|
Double min = 0d;
|
|
|
|
|
//获取最大
|
|
|
|
|
Double max = ocrResultDTOList.stream().sorted((a, b) -> b.getTextRate().compareTo(a.getTextRate())).findFirst().get().getTextRate();
|
|
|
|
|
Double max = 0d;
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ocrResultDTOList)) {
|
|
|
|
|
min = ocrResultDTOList.stream().sorted((a, b) -> a.getTextRate().compareTo(b.getTextRate())).findFirst().get().getTextRate();
|
|
|
|
|
max = ocrResultDTOList.stream().sorted((a, b) -> b.getTextRate().compareTo(a.getTextRate())).findFirst().get().getTextRate();
|
|
|
|
|
}
|
|
|
|
|
//OCR和NlU执行时间总和(秒)
|
|
|
|
|
double ocrAndNluTimeSum = identifyDetailList.stream().mapToDouble(i -> (i.getOcrTime() == null ? 0 : i.getOcrTime()) + (i.getNluTime() == null ? 0 : i.getNluTime())).sum();
|
|
|
|
|
//执行时间(毫秒)
|
|
|
|
@ -1080,8 +1088,8 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
|
responseBody.put("allExecutionTime",executionTime);
|
|
|
|
|
responseBody.put("detailList", ocrResultDTOList);
|
|
|
|
|
if (ocrResultDTOList.size()==0) {
|
|
|
|
|
//没有匹配结果,直接失败
|
|
|
|
|
responseBody.put("taskResult",0);
|
|
|
|
|
//没有匹配结果
|
|
|
|
|
responseBody.put("taskResult",1);
|
|
|
|
|
}else{
|
|
|
|
|
long count = ocrResultDTOList.stream().filter(o -> !o.getRuleValidation()).count();
|
|
|
|
|
responseBody.put("taskResult",count>0?0:1);//匹配成功或失败
|
|
|
|
|