|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package org.jeecg.modules.ocr.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -17,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.jeecg.common.system.vo.DictModel;
|
|
|
|
|
import org.jeecg.common.util.AssertUtils;
|
|
|
|
|
import org.jeecg.common.util.RedisUtil;
|
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrIdentify;
|
|
|
|
@ -31,6 +33,8 @@ import org.jeecg.modules.ocr.utils.FileOUtils;
|
|
|
|
|
import org.jeecg.modules.ocr.vo.OcrIdentifyVo;
|
|
|
|
|
import org.jeecg.modules.ocr.vo.OcrMetadataConfigVo;
|
|
|
|
|
import org.jeecg.modules.ocr.vo.OcrRuleCheckVo;
|
|
|
|
|
import org.jeecg.modules.system.service.ISysDictItemService;
|
|
|
|
|
import org.jeecg.modules.system.service.ISysDictService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
@ -61,6 +65,10 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
|
|
|
|
|
@Autowired
|
|
|
|
|
private IOcrRuleCheckService ocrRuleCheckService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysDictService sysDictService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysDictItemService sysDictItemService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
/**
|
|
|
|
|
* 分页列表查询
|
|
|
|
@ -117,7 +125,18 @@ public class OcrIdentifyController extends JeecgController<OcrIdentify, IOcrIden
|
|
|
|
|
AssertUtils.notEmpty(ocrIdentify.getPriority(), "请选择[优先级]");
|
|
|
|
|
//获取识别的图片
|
|
|
|
|
List<String> fileList = new ArrayList<>();
|
|
|
|
|
List<String> fileUrlList = FileOUtils.fileLists(ocrIdentify.getIdentifyUrl());
|
|
|
|
|
|
|
|
|
|
//获取相对路径
|
|
|
|
|
List<DictModel> ocr_relative_path = sysDictService.queryDictItemsByCode("ocr_relative_path");
|
|
|
|
|
String relativePath=null;
|
|
|
|
|
if (ocr_relative_path!=null && ocr_relative_path.size()>0) {
|
|
|
|
|
for (DictModel dictModel : ocr_relative_path) {
|
|
|
|
|
if (dictModel.getValue().equals("0")) {
|
|
|
|
|
relativePath= dictModel.getText();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<String> fileUrlList = FileOUtils.fileLists(relativePath,ocrIdentify.getIdentifyUrl());
|
|
|
|
|
AssertUtils.notNull(fileUrlList, "图片地址不存在");
|
|
|
|
|
for (String fileUrl : fileUrlList) {
|
|
|
|
|
//判断附件是否是 图片格式
|
|
|
|
|