pull/138/head
rongfeng 1 year ago
parent 8955091768
commit f6b34b0e5c

@ -329,7 +329,11 @@ public class OcrPictureController extends BaseController {
IPage<OcrPicture> pageList = ocrPictureService.page(page, queryWrapper);
List<OcrPicture> ocrPictures = pageList.getRecords();
List<OcrPicture> ocrPicturesNew = new ArrayList<>();
Map<Long, List<OcrPicture>> completeSimilarGroupMap = ocrPictures.stream().filter(s->Objects.nonNull(s.getCompleteSimilarGroupId())).collect(Collectors.groupingBy(OcrPicture::getCompleteSimilarGroupId));
for (OcrPicture ocrPictureOne : ocrPictures) {
filterScoreNoGroup(ocrPictureOne,completeSimilarGroupMap);
LambdaQueryWrapper<OcrTaskchildPicture> ocrTaskchildPictureLambdaQueryWrapper = new LambdaQueryWrapper<>();
ocrTaskchildPictureLambdaQueryWrapper.eq(OcrTaskchildPicture::getPictureid, ocrPictureOne.getId());
OcrTaskchildPicture ocrTaskchildPicture = ocrTaskchildPictureService.getOne(ocrTaskchildPictureLambdaQueryWrapper);
@ -357,6 +361,13 @@ public class OcrPictureController extends BaseController {
return ResultVoUtil.success(pageList);
}
private void filterScoreNoGroup(OcrPicture ocrPictureOne,Map<Long, List<OcrPicture>> completeSimilarGroupMap){
//过滤阈值为100的但是没有对应分类的图片
if(Objects.nonNull(ocrPictureOne.getSimilarityscore())&&ocrPictureOne.getSimilarityscore()==100&&Objects.nonNull(ocrPictureOne.getCompleteSimilarGroupId())&&completeSimilarGroupMap.get(ocrPictureOne.getCompleteSimilarGroupId()).size()>1){
ocrPictureOne.setSimilarityscore(0);
ocrPictureOne.setIsRepeat(1);
}
}
/**
*
*

@ -95,15 +95,15 @@ public class ImageClassUtil {
JSONObject jsonObjectSimi = JSON.parseObject(responseDataVi);
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0") && jsonObjectSimi.get("data") != null && jsonObjectSimi.getJSONArray("data").size() > 0) {
ocrPictureLog.setCallStatus("1");
ocrPictureLog.setCallMsg(responseDataVi);
ocrPictureLog.setCallMsg("req:"+jsonObjectVi.toJSONString()+"\nrep:"+responseDataVi);
} else {
ocrPictureLog.setCallStatus("2");
ocrPictureLog.setCallMsg(responseDataVi);
ocrPictureLog.setCallMsg("req:"+jsonObjectVi.toJSONString()+"\nrep:"+responseDataVi);
}
} catch (Exception e) {
logger.error("classify={}", e);
ocrPictureLog.setCallStatus("3");
ocrPictureLog.setCallMsg(responseDataVi+"Exception:"+e.getMessage());
ocrPictureLog.setCallMsg("req:"+jsonObjectVi.toJSONString()+"\nrep:"+responseDataVi+"Exception:"+e.getMessage());
} finally {
ApplicationContext applicationContext = SpringUtil.getApplicationContext();
OcrPictureLogService ocrPictureLogService = applicationContext.getBean(OcrPictureLogService.class);

Loading…
Cancel
Save