master
周文涛 2 years ago
parent d15ae5b208
commit 3a41bd5e0e

@ -891,12 +891,15 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
long count = fieldRightMap.values().stream().filter(o->!o).count();
//long count = ocrResultDTOList.stream().filter(o -> !o.getRuleValidation()).count();
responseBody.put("taskResult",count>0?0:1);//匹配成功或失败
List<String> haveRateTagList = ocrResultDTOList.stream().filter(o -> o.getTextRate() > 0).map(OcrResultDTO::getTag).collect(Collectors.toList());
Set<String> haveRateTagList = ocrResultDTOList.stream().filter(o -> o.getTextRate() > 0).map(OcrResultDTO::getTag).collect(Collectors.toSet());
List<OcrResultDTO> newResultDTOList=new ArrayList<>();
//过滤掉0的值
for (OcrResultDTO o : ocrResultDTOList) {
if (haveRateTagList.contains(o.getTag())) {
newResultDTOList.addAll(ocrResultDTOList.stream().filter(oo -> o.getTag().equals(oo.getTag()) && o.getTextRate() > 0).collect(Collectors.toList()));
if (o.getTextRate()>0) {
newResultDTOList.add(o);
}
}else{
newResultDTOList.add(o);
}

@ -2,6 +2,7 @@ package org.jeecg.modules.ocr.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -76,7 +77,7 @@ public class CallBackWlyUtils {
System.out.println("=============================================");
System.out.println(JSONObject.toJSONString(callBackWlyRequestBody));
System.out.println("=============================================");
semanticResponseJson = RestUtil.post("https://192.168.1.21:8686/api/task/image/ocr/callback", JSONObject.parseObject(JSONObject.toJSONString(callBackWlyRequestBody)));
semanticResponseJson = RestUtil.post("https://192.168.1.21:8686/api/task/image/ocr/callback", JSONObject.parseObject(JSONObject.toJSONString(callBackWlyRequestBody, SerializerFeature.WriteNullStringAsEmpty)));
} catch (org.springframework.web.client.ResourceAccessException e) {
log.error("请求无量云回调接口失败-拒绝连接 (Connection refused)");
log.error(e.getMessage());

Loading…
Cancel
Save