|
|
@ -13,12 +13,15 @@ import cn.jyjz.xiaoyao.oa.from.service.CategoryService;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataDao.OcrPictureMybatisDao;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataDao.OcrPictureMybatisDao;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.*;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.dataobject.*;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.*;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.service.*;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.thread.TaskQueue;
|
|
|
|
|
|
|
|
import cn.jyjz.xiaoyao.ocr.thread.entity.PictureImgToLocalEntity;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.DataDictionaryUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.DataDictionaryUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.ImageClassUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.ImageClassUtil;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchEnum;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchEnum;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchParaFormatting;
|
|
|
|
import cn.jyjz.xiaoyao.ocr.util.SearchParaFormatting;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@ -48,6 +51,9 @@ import java.util.List;
|
|
|
|
@Service("ocrPictureService")
|
|
|
|
@Service("ocrPictureService")
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao, OcrPicture> implements OcrPictureService {
|
|
|
|
public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao, OcrPicture> implements OcrPictureService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${ocr.api.wly.localImagePath}")
|
|
|
|
|
|
|
|
private String localImagePath;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private OcrPictureMybatisDao ocrpicturemybatisdao;
|
|
|
|
private OcrPictureMybatisDao ocrpicturemybatisdao;
|
|
|
|
|
|
|
|
|
|
|
@ -273,79 +279,175 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public ResultVo createTaskChild(List<OcrPicture> ocrPictureList, String tenantId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ResultVo createPackageTask(List<OcrPicture> ocrPictureList, String tenantId, UserToken sysUser, String search_month, HttpServletRequest request, String buessinessno) {
|
|
|
|
//图片错误信息
|
|
|
|
//图片错误信息
|
|
|
|
StringBuffer error = new StringBuffer();
|
|
|
|
StringBuffer error = new StringBuffer();
|
|
|
|
//项目错误信息
|
|
|
|
//项目错误信息
|
|
|
|
StringBuffer errorProject = new StringBuffer();
|
|
|
|
StringBuffer errorProject = new StringBuffer();
|
|
|
|
//流程错误信息
|
|
|
|
//流程错误信息
|
|
|
|
StringBuffer errorFlow = new StringBuffer();
|
|
|
|
StringBuffer errorFlow = new StringBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
//记录任务相似度为百分百的任务主键
|
|
|
|
//记录任务相似度为百分百的任务主键
|
|
|
|
List<Long> pointsList = new ArrayList<>();
|
|
|
|
List<Long> pointsList = new ArrayList<>();
|
|
|
|
//图片信息不能为空
|
|
|
|
//图片信息不能为空
|
|
|
|
if (null != ocrPictureList && !ocrPictureList.isEmpty()) {
|
|
|
|
if (null != ocrPictureList && !ocrPictureList.isEmpty()) {
|
|
|
|
//生成任务包
|
|
|
|
//生成任务包
|
|
|
|
//String packageName = seqManageService.getSeqNextNo("AI任务包");
|
|
|
|
//String packageName = seqManageService.getSeqNextNo("AI任务包");
|
|
|
|
|
|
|
|
//创建任务包
|
|
|
|
|
|
|
|
OcrPackagetask ocrPackagetask = this.ocrPackagetaskService.create(buessinessno, tenantId, sysUser);
|
|
|
|
|
|
|
|
if (null == ocrPackagetask) {
|
|
|
|
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
|
|
|
|
}
|
|
|
|
//用于标记相似度是否存在百分百的情况
|
|
|
|
//用于标记相似度是否存在百分百的情况
|
|
|
|
|
|
|
|
|
|
|
|
List<OcrPicture> newList = new ArrayList<>();
|
|
|
|
List<OcrPicture> newList = new ArrayList<>();
|
|
|
|
for (OcrPicture ocrPicture : ocrPictureList) {
|
|
|
|
for (OcrPicture ocrPicture : ocrPictureList) {
|
|
|
|
|
|
|
|
//如果当前图片已经生成任务包,直接跳过
|
|
|
|
|
|
|
|
if (ocrPicture.getTaskstatus().equals("1")) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
//图片查重的比对图片集合
|
|
|
|
//图片查重的比对图片集合
|
|
|
|
List<OcrPicture> compareList = new ArrayList<>();
|
|
|
|
List<OcrPicture> compareList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
//非历史图片主键集合
|
|
|
|
//非历史图片主键集合
|
|
|
|
List<String> picturecompareList = new ArrayList<>();
|
|
|
|
List<String> picturecompareList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
boolean havePoint = false;
|
|
|
|
boolean havePoint = false;
|
|
|
|
//二次遍历进行比对
|
|
|
|
//二次遍历进行比对
|
|
|
|
for (OcrPicture ocrPictureNext : ocrPictureList) {
|
|
|
|
for (OcrPicture ocrPictureNext : ocrPictureList) {
|
|
|
|
|
|
|
|
|
|
|
|
if (ocrPictureNext.getId().longValue() == ocrPicture.getId().longValue()) {
|
|
|
|
if (ocrPictureNext.getId().longValue() == ocrPicture.getId().longValue()) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//TODO 接口请求判断重复情况
|
|
|
|
//TODO 接口请求判断重复情况
|
|
|
|
JSONObject jsonObjectSimi = ImageClassUtil.getSimilarity(ocrPicture.getImgurl(),
|
|
|
|
logService.addLog(103, "AI获取图片相似度接口", sysUser, "sendParams");
|
|
|
|
ocrPictureNext.getImgurl(),
|
|
|
|
JSONObject jsonObjectSimi = ImageClassUtil.getSimilarity(StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPicture.getImgurl() : ocrPicture.getLocalpictrueurl(),
|
|
|
|
|
|
|
|
StringUtils.isBlank(ocrPicture.getLocalpictrueurl()) ? ocrPictureNext.getImgurl() : ocrPicture.getLocalpictrueurl(),
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
System.out.println("responseDataXs--code = [" + jsonObjectSimi.get("code") + "]");
|
|
|
|
System.out.println("responseDataXs--code = [" + jsonObjectSimi.get("code") + "]");
|
|
|
|
System.out.println("responseDataXs--similarity = [" + jsonObjectSimi.get("similarity") + "]");
|
|
|
|
System.out.println("responseDataXs--similarity = [" + jsonObjectSimi.get("similarity") + "]");
|
|
|
|
|
|
|
|
|
|
|
|
String resultValue = "";
|
|
|
|
String resultValue = "";
|
|
|
|
|
|
|
|
|
|
|
|
//返回内容为零,表示成功,否则表示失败
|
|
|
|
//返回内容为零,表示成功,否则表示失败
|
|
|
|
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0")) {
|
|
|
|
if (null != jsonObjectSimi && jsonObjectSimi.getString("code").equals("0")) {
|
|
|
|
|
|
|
|
|
|
|
|
resultValue = jsonObjectSimi.getString("similarity");
|
|
|
|
resultValue = jsonObjectSimi.getString("similarity");
|
|
|
|
ocrPictureNext.setResult(resultValue);
|
|
|
|
ocrPictureNext.setResult(resultValue);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
resultValue = "0";
|
|
|
|
resultValue = "0";
|
|
|
|
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");
|
|
|
|
int val = b1.compareTo(b2);
|
|
|
|
int val = b1.compareTo(b2);
|
|
|
|
if (val == 0) {
|
|
|
|
if (val == 0) {
|
|
|
|
havePoint = true;
|
|
|
|
havePoint = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//如果当前图片未生成任务需要临时保存
|
|
|
|
//如果当前图片未生成任务需要临时保存
|
|
|
|
if (ocrPictureNext.getTaskstatus().equals("0")) {
|
|
|
|
if (ocrPictureNext.getTaskstatus().equals("0")) {
|
|
|
|
picturecompareList.add(ocrPictureNext.getId().toString());
|
|
|
|
picturecompareList.add(ocrPictureNext.getId().toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
compareList.add(ocrPictureNext);
|
|
|
|
compareList.add(ocrPictureNext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bubbleSortOpt(compareList);
|
|
|
|
bubbleSortOpt(compareList);
|
|
|
|
//从大到小进行排序
|
|
|
|
//从大到小进行排序
|
|
|
|
ocrPicture.setListCom(compareList);
|
|
|
|
ocrPicture.setListCom(compareList);
|
|
|
|
|
|
|
|
|
|
|
|
//非历史图片主键集合
|
|
|
|
//非历史图片主键集合
|
|
|
|
ocrPicture.setPicturecompareList(picturecompareList);
|
|
|
|
ocrPicture.setPicturecompareList(picturecompareList);
|
|
|
|
|
|
|
|
//查询项目对象
|
|
|
|
|
|
|
|
if (null == ocrPicture.getCategoryid()) {
|
|
|
|
|
|
|
|
//TODO 没有对应项目,返回提示信息
|
|
|
|
|
|
|
|
if (null != error && error.length() > 1) {
|
|
|
|
|
|
|
|
error.append("," + ocrPicture.getImgname());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
error.append(ocrPicture.getImgname());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Category category = categoryService.getById(ocrPicture.getCategoryid());
|
|
|
|
|
|
|
|
if (null == category) {
|
|
|
|
|
|
|
|
if (null != errorProject && errorProject.length() > 1) {
|
|
|
|
|
|
|
|
errorProject.append("," + ocrPicture.getImgname());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
errorProject.append(ocrPicture.getImgname());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
} else if (StringUtils.isBlank(category.getProcessdefinitionid())) {
|
|
|
|
|
|
|
|
if (null != errorFlow && errorFlow.length() > 1) {
|
|
|
|
|
|
|
|
errorFlow.append("," + category.getCategoryname());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
errorFlow.append(category.getCategoryname());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建工单,如果创建成功,增加标志,用于过滤条件使用
|
|
|
|
|
|
|
|
OcrTaskchildPicture ocrTaskchildPicture = this.updateTaskChild(ocrPicture, ocrPackagetask.getId(), buessinessno);
|
|
|
|
|
|
|
|
if (null != ocrTaskchildPicture) {
|
|
|
|
|
|
|
|
if (havePoint) {
|
|
|
|
|
|
|
|
pointsList.add(ocrTaskchildPicture.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
newList.add(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//批量更新 pointsList 主键相似度为百分百的数据
|
|
|
|
|
|
|
|
if (null != pointsList && !pointsList.isEmpty()) {
|
|
|
|
|
|
|
|
this.ocrTaskchildPictureService.markPoint(pointsList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(search_month)) {
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) <= 12 && Integer.parseInt(search_month) > 0) {
|
|
|
|
|
|
|
|
ocrPackagetask.setSearchtimes(SearchEnum.getName(Integer.parseInt(search_month)));
|
|
|
|
|
|
|
|
} else if (StringUtils.isNotBlank(search_month) && Integer.parseInt(search_month) > 20) {
|
|
|
|
|
|
|
|
ocrPackagetask.setSearchtimes(SearchEnum.getName((Integer.parseInt(search_month) - 20)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ocrPackagetask.setPictureno(ocrPictureList.size());
|
|
|
|
|
|
|
|
this.ocrPackagetaskService.updateById(ocrPackagetask);
|
|
|
|
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
|
|
|
|
for (OcrPicture ocrPicture : newList) {
|
|
|
|
|
|
|
|
ocrPicture.setTaskstatus("1");
|
|
|
|
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(error) && StringUtils.isBlank(errorProject) && StringUtils.isBlank(errorFlow)) {
|
|
|
|
|
|
|
|
return ResultVoUtil.success();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String msg = (StringUtils.isBlank(error)) ? "" : error.toString() + ",图片没有对应项目,无法查重。";
|
|
|
|
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorProject)) ? "" : errorProject.toString() + ",图片没有对应项目,无法查重。");
|
|
|
|
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorFlow)) ? "" : errorFlow.toString() + ",项目没有配置审批流程,无法查重。");
|
|
|
|
|
|
|
|
return ResultVoUtil.success(msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public OcrTaskchildPicture updateTaskChild(OcrPicture ocrPicture, Long packageid, String buessinessno) {
|
|
|
|
|
|
|
|
OcrTaskchildPicture ocrTaskchildPicture = ocrTaskchildPictureService.getOne(new LambdaQueryWrapper<OcrTaskchildPicture>().eq(OcrTaskchildPicture::getPictureid, ocrPicture.getId()));
|
|
|
|
|
|
|
|
ocrTaskchildPicture.setBuessinessno(buessinessno);
|
|
|
|
|
|
|
|
ocrTaskchildPicture.setPackageid(packageid);
|
|
|
|
|
|
|
|
StringBuffer pcid = new StringBuffer();
|
|
|
|
|
|
|
|
StringBuffer result = new StringBuffer();
|
|
|
|
|
|
|
|
for (OcrPicture comp : ocrPicture.getListCom()) {
|
|
|
|
|
|
|
|
if (null == pcid || pcid.toString().length() < 1) {
|
|
|
|
|
|
|
|
pcid.append(comp.getId());
|
|
|
|
|
|
|
|
result.append(comp.getResult());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pcid.append("," + comp.getId());
|
|
|
|
|
|
|
|
result.append("," + comp.getResult());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ocrTaskchildPicture.setOcpictureid(pcid.toString());
|
|
|
|
|
|
|
|
ocrTaskchildPicture.setPictureresult(result.toString());
|
|
|
|
|
|
|
|
ocrTaskchildPicture.setPicturecompare(String.join(",", ocrPicture.getPicturecompareList()));
|
|
|
|
|
|
|
|
return ocrTaskchildPictureService.updateById(ocrTaskchildPicture) ? ocrTaskchildPicture : null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ResultVo createTaskChild(List<OcrPicture> ocrPictureList, String tenantId) {
|
|
|
|
|
|
|
|
//图片错误信息
|
|
|
|
|
|
|
|
StringBuffer error = new StringBuffer();
|
|
|
|
|
|
|
|
//项目错误信息
|
|
|
|
|
|
|
|
StringBuffer errorProject = new StringBuffer();
|
|
|
|
|
|
|
|
//流程错误信息
|
|
|
|
|
|
|
|
StringBuffer errorFlow = new StringBuffer();
|
|
|
|
|
|
|
|
//图片信息不能为空
|
|
|
|
|
|
|
|
if (null != ocrPictureList && !ocrPictureList.isEmpty()) {
|
|
|
|
|
|
|
|
//用于标记相似度是否存在百分百的情况
|
|
|
|
|
|
|
|
List<OcrPicture> newList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (OcrPicture ocrPicture : ocrPictureList) {
|
|
|
|
|
|
|
|
boolean havePoint = false;
|
|
|
|
//查询项目对象
|
|
|
|
//查询项目对象
|
|
|
|
if (null == ocrPicture.getCategoryid()) {
|
|
|
|
if (null == ocrPicture.getCategoryid()) {
|
|
|
|
//TODO 没有对应项目,返回提示信息
|
|
|
|
//TODO 没有对应项目,返回提示信息
|
|
|
@ -388,41 +490,19 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
ocrTaskchildPicture.getId().toString(),
|
|
|
|
ocrTaskchildPicture.getId().toString(),
|
|
|
|
category.getServicename()
|
|
|
|
category.getServicename()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (havePoint) {
|
|
|
|
|
|
|
|
pointsList.add(ocrTaskchildPicture.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 需要测试
|
|
|
|
//TODO 需要测试
|
|
|
|
ocrPicture.setTaskchildpictureid(ocrTaskchildPicture.getId().toString());
|
|
|
|
ocrPicture.setTaskchildpictureid(ocrTaskchildPicture.getId().toString());
|
|
|
|
ocrPicture.setWorkStatus("1");
|
|
|
|
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
this.updateById(ocrPicture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
newList.add(ocrPicture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//批量更新 pointsList 主键相似度为百分百的数据
|
|
|
|
|
|
|
|
if (null != pointsList && !pointsList.isEmpty()) {
|
|
|
|
|
|
|
|
this.ocrTaskchildPictureService.markPoint(pointsList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//原主图设置为任务包已经生成
|
|
|
|
|
|
|
|
for (OcrPicture ocrPicture : newList) {
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
|
|
String msg = (StringUtils.isBlank(error)) ? "" : error.toString() + ",图片没有对应项目,无法查重。";
|
|
|
|
String msg = (StringUtils.isBlank(error)) ? "" : error.toString() + ",图片没有对应项目,无法查重。";
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorProject)) ? "" : errorProject.toString() + ",图片没有对应项目,无法查重。");
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorProject)) ? "" : errorProject.toString() + ",图片没有对应项目,无法查重。");
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorFlow)) ? "" : errorFlow.toString() + ",项目没有配置审批流程,无法查重。");
|
|
|
|
msg = msg + ((StringUtils.isBlank(errorFlow)) ? "" : errorFlow.toString() + ",项目没有配置审批流程,无法查重。");
|
|
|
|
return ResultVoUtil.success(msg);
|
|
|
|
return ResultVoUtil.success(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
return ResultVoUtil.error("失败。");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -675,7 +755,6 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
public int savePictures(List<OcrPicture> ocrPictureList) {
|
|
|
|
public int savePictures(List<OcrPicture> ocrPictureList) {
|
|
|
|
//1.字典数据 解析入库
|
|
|
|
//1.字典数据 解析入库
|
|
|
|
boolean b = dataDictionaryUtil.pictureDataDictionarySaveArray(ocrPictureList);
|
|
|
|
boolean b = dataDictionaryUtil.pictureDataDictionarySaveArray(ocrPictureList);
|
|
|
@ -687,18 +766,27 @@ public class OcrPictureServiceImpl extends BaseServiceImpl<OcrPictureMybatisDao,
|
|
|
|
picture.setImgurl(interfaceDomain + picture.getImgurl());
|
|
|
|
picture.setImgurl(interfaceDomain + picture.getImgurl());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean saveBatch = this.saveBatch(ocrPictureList);
|
|
|
|
//3.添加图片信息
|
|
|
|
//3.添加图片信息
|
|
|
|
if (this.saveBatch(ocrPictureList)) {
|
|
|
|
if (saveBatch) {
|
|
|
|
|
|
|
|
this.convertImage(ocrPictureList);
|
|
|
|
this.createTaskChild(ocrPictureList, ocrPictureList.get(0).getTenantId().toString());
|
|
|
|
this.createTaskChild(ocrPictureList, ocrPictureList.get(0).getTenantId().toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ocrPictureList.size();
|
|
|
|
return ocrPictureList.size();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void convertImage(List<OcrPicture> list) {
|
|
|
|
|
|
|
|
for (OcrPicture ocrPicture : list) {
|
|
|
|
|
|
|
|
PictureImgToLocalEntity entity = new PictureImgToLocalEntity();
|
|
|
|
|
|
|
|
entity.setPictureId(ocrPicture.getId());
|
|
|
|
|
|
|
|
entity.setImgUrl(ocrPicture.getImgurl());
|
|
|
|
|
|
|
|
String imgurl = ocrPicture.getImgurl();
|
|
|
|
|
|
|
|
entity.setLocalPath(localImagePath + imgurl.substring(imgurl.lastIndexOf("/")));
|
|
|
|
|
|
|
|
TaskQueue.pictureImgToLocalPushData(entity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 格式化筛选关系
|
|
|
|
* 格式化筛选关系
|
|
|
|
*
|
|
|
|
*
|
|
|
|