|
|
@ -241,9 +241,9 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
//TODO 需要测试
|
|
|
|
//TODO 需要测试
|
|
|
|
ocrPicture.setTaskchildpictureid(ocrTaskchildPicture.getId().toString());
|
|
|
|
ocrPicture.setTaskchildpictureid(ocrTaskchildPicture.getId().toString());
|
|
|
|
ocrPicture.setWorkStatus("1");
|
|
|
|
ocrPicture.setWorkStatus("1");
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
// this.updateById(ocrPicture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ocrPicture.setTaskstatus("1");
|
|
|
|
newList.add(ocrPicture);
|
|
|
|
newList.add(ocrPicture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -252,7 +252,6 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
this.ocrTaskchildPictureService.markPoint(pointsList);
|
|
|
|
this.ocrTaskchildPictureService.markPoint(pointsList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(search_month)) {
|
|
|
|
if (StringUtils.isNotBlank(search_month)) {
|
|
|
|
if (StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0) {
|
|
|
|
if (StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0) {
|
|
|
|
|
|
|
|
|
|
|
@ -265,10 +264,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
this.ocrPackagetaskService.updateById(ocrPackagetask);
|
|
|
|
this.ocrPackagetaskService.updateById(ocrPackagetask);
|
|
|
|
|
|
|
|
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
for (OcrPicture ocrPicture : newList) {
|
|
|
|
this.updateBatchById(ocrPictureList);
|
|
|
|
ocrPicture.setTaskstatus("1");
|
|
|
|
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(error) && StringUtils.isBlank(errorProject) && StringUtils.isBlank(errorFlow)) {
|
|
|
|
if (StringUtils.isBlank(error) && StringUtils.isBlank(errorProject) && StringUtils.isBlank(errorFlow)) {
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
return ResultVoUtil.success();
|
|
|
@ -305,6 +301,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//用于标记相似度是否存在百分百的情况
|
|
|
|
//用于标记相似度是否存在百分百的情况
|
|
|
|
List<OcrPicture> newList = new ArrayList<>();
|
|
|
|
List<OcrPicture> newList = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String, String> resultMap = new HashMap<>();
|
|
|
|
for (OcrPicture ocrPicture : ocrPictureList) {
|
|
|
|
for (OcrPicture ocrPicture : ocrPictureList) {
|
|
|
|
//如果当前图片已经生成任务包,直接跳过
|
|
|
|
//如果当前图片已经生成任务包,直接跳过
|
|
|
|
if (ocrPicture.getTaskstatus().equals("1")) {
|
|
|
|
if (ocrPicture.getTaskstatus().equals("1")) {
|
|
|
@ -315,6 +312,15 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
//非历史图片主键集合
|
|
|
|
//非历史图片主键集合
|
|
|
|
List<String> picturecompareList = new ArrayList<>();
|
|
|
|
List<String> picturecompareList = new ArrayList<>();
|
|
|
|
boolean havePoint = false;
|
|
|
|
boolean havePoint = false;
|
|
|
|
|
|
|
|
logService.addLog(103, "AI获取图片相似度接口", sysUser, "sendParams");
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(ocrPicture.getImgHash())) {
|
|
|
|
|
|
|
|
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPicture.getLocalpictrueurl());
|
|
|
|
|
|
|
|
if (map != null) {
|
|
|
|
|
|
|
|
ocrPicture.setImgHash(map.get("hash"));
|
|
|
|
|
|
|
|
ocrPicture.setClassificationid(map.get("classId"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// this.updateById(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
//二次遍历进行比对
|
|
|
|
//二次遍历进行比对
|
|
|
|
for (OcrPicture ocrPictureNext : ocrPictureList) {
|
|
|
|
for (OcrPicture ocrPictureNext : ocrPictureList) {
|
|
|
|
//分类不一致的也不需要进行比对
|
|
|
|
//分类不一致的也不需要进行比对
|
|
|
@ -323,28 +329,25 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//分类不一致的也不需要进行比对
|
|
|
|
//分类不一致的也不需要进行比对
|
|
|
|
//TODO 接口请求判断重复情况
|
|
|
|
//TODO 接口请求判断重复情况
|
|
|
|
logService.addLog(103, "AI获取图片相似度接口", sysUser, "sendParams");
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(ocrPicture.getImgHash())) {
|
|
|
|
|
|
|
|
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPicture.getLocalpictrueurl());
|
|
|
|
|
|
|
|
if (map != null) {
|
|
|
|
|
|
|
|
ocrPicture.setImgHash(map.get("hash"));
|
|
|
|
|
|
|
|
ocrPicture.setClassificationid(map.get("classId"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(ocrPictureNext.getImgHash())) {
|
|
|
|
if (StringUtils.isBlank(ocrPictureNext.getImgHash())) {
|
|
|
|
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPictureNext.getLocalpictrueurl());
|
|
|
|
Map<String, String> map = this.getOcrPictureClassifyAndHash(ocrPictureNext.getLocalpictrueurl());
|
|
|
|
if (map != null) {
|
|
|
|
if (map != null) {
|
|
|
|
ocrPictureNext.setImgHash(map.get("hash"));
|
|
|
|
ocrPictureNext.setImgHash(map.get("hash"));
|
|
|
|
ocrPictureNext.setClassificationid(map.get("classId"));
|
|
|
|
ocrPictureNext.setClassificationid(map.get("classId"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.updateById(ocrPictureNext);
|
|
|
|
// this.updateById(ocrPictureNext);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String resultValue = "";
|
|
|
|
|
|
|
|
String strId = ocrPicture.getId() + ":" + ocrPictureNext.getId();
|
|
|
|
|
|
|
|
String strNextId = ocrPictureNext.getId() + ":" + ocrPicture.getId();
|
|
|
|
|
|
|
|
if (resultMap.containsKey(strId) || resultMap.containsKey(strNextId)) {
|
|
|
|
|
|
|
|
resultValue = resultMap.get(strId) == null ? resultMap.get(strNextId) : resultMap.get(strId);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String img = StringUtils.isBlank(ocrPicture.getImgHash()) ? StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPicture.getImgurl() : ocrPicture.getLocalpictrueurl() : ocrPicture.getImgHash();
|
|
|
|
|
|
|
|
String imgNext = StringUtils.isBlank(ocrPictureNext.getImgHash()) ? StringUtils.isBlank(ocrPictureNext.getLocalpictrueurl()) ? ocrPictureNext.getImgurl() : ocrPictureNext.getLocalpictrueurl() : ocrPictureNext.getImgHash();
|
|
|
|
|
|
|
|
resultValue = HashCompareUtil.cmpHash(img, imgNext);
|
|
|
|
|
|
|
|
resultMap.put(strId, resultValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String img = StringUtils.isBlank(ocrPicture.getImgHash()) ? StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPicture.getImgurl() : ocrPicture.getLocalpictrueurl() : ocrPicture.getImgHash();
|
|
|
|
|
|
|
|
String imgNext = StringUtils.isBlank(ocrPictureNext.getImgHash()) ? StringUtils.isBlank(ocrPictureNext.getLocalpictrueurl()) ? ocrPictureNext.getImgurl() : ocrPictureNext.getLocalpictrueurl() : ocrPictureNext.getImgHash();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String resultValue = HashCompareUtil.cmpHash(img, imgNext);
|
|
|
|
|
|
|
|
ocrPictureNext.setResult(resultValue);
|
|
|
|
ocrPictureNext.setResult(resultValue);
|
|
|
|
BigDecimal b1 = new BigDecimal(resultValue);
|
|
|
|
BigDecimal b1 = new BigDecimal(resultValue);
|
|
|
|
BigDecimal b2 = new BigDecimal("100");
|
|
|
|
BigDecimal b2 = new BigDecimal("100");
|
|
|
@ -358,6 +361,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compareList.add(ocrPictureNext);
|
|
|
|
compareList.add(ocrPictureNext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// this.updateBatchById(ocrPictureList);
|
|
|
|
bubbleSortOpt(compareList);
|
|
|
|
bubbleSortOpt(compareList);
|
|
|
|
//从大到小进行排序
|
|
|
|
//从大到小进行排序
|
|
|
|
ocrPicture.setListCom(compareList);
|
|
|
|
ocrPicture.setListCom(compareList);
|
|
|
@ -370,7 +374,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
pointsList.add(ocrTaskchildPicture.getId());
|
|
|
|
pointsList.add(ocrTaskchildPicture.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newList.add(ocrPicture);
|
|
|
|
ocrPicture.setTaskstatus("1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//批量更新 pointsList 主键相似度为百分百的数据
|
|
|
|
//批量更新 pointsList 主键相似度为百分百的数据
|
|
|
|
if (null != pointsList && !pointsList.isEmpty()) {
|
|
|
|
if (null != pointsList && !pointsList.isEmpty()) {
|
|
|
@ -386,10 +390,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
ocrPackagetask.setPictureno(ocrPictureList.size());
|
|
|
|
ocrPackagetask.setPictureno(ocrPictureList.size());
|
|
|
|
this.ocrPackagetaskService.updateById(ocrPackagetask);
|
|
|
|
this.ocrPackagetaskService.updateById(ocrPackagetask);
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
for (OcrPicture ocrPicture : newList) {
|
|
|
|
this.updateBatchById(ocrPictureList);
|
|
|
|
ocrPicture.setTaskstatus("1");
|
|
|
|
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(error) && StringUtils.isBlank(errorProject) && StringUtils.isBlank(errorFlow)) {
|
|
|
|
if (StringUtils.isBlank(error) && StringUtils.isBlank(errorProject) && StringUtils.isBlank(errorFlow)) {
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -447,7 +448,7 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
ocrTaskchildPicture.setPictureresult(result.toString());
|
|
|
|
ocrTaskchildPicture.setPictureresult(result.toString());
|
|
|
|
ocrTaskchildPicture.setPicturecompare(String.join(",", ocrPicture.getPicturecompareList()));
|
|
|
|
ocrTaskchildPicture.setPicturecompare(String.join(",", ocrPicture.getPicturecompareList()));
|
|
|
|
ocrPicture.setSimilarityscore(max);
|
|
|
|
ocrPicture.setSimilarityscore(max);
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
// this.updateById(ocrPicture);
|
|
|
|
return ocrTaskchildPictureService.updateById(ocrTaskchildPicture) ? ocrTaskchildPicture : null;
|
|
|
|
return ocrTaskchildPictureService.updateById(ocrTaskchildPicture) ? ocrTaskchildPicture : null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|