Compare commits

...

2 Commits

@ -17,8 +17,13 @@ public class OcrConstant {
*/
public static String ruleCheckSplitChar="&";
public static String ruleCheckOrChar="||";
public static String ruleHz="||";
public static String ruleZkh="\\(";
public static String ruleYkh="\\)";
public static String ruleDyh=">";
public static String ruleXyh="<";
public static String ruleTh="!";
public static String ruleBq="&&";
public static String ruleCheckValueRightChar="=";
/**

@ -237,13 +237,13 @@ public class RestUtil {
//回调接口
if (url.contains("callback")) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(30000);
requestFactory.setReadTimeout(30000);
requestFactory.setConnectTimeout(300000);
requestFactory.setReadTimeout(300000);
RT = new RestTemplate(requestFactory);
}else{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(300 *1000);
requestFactory.setReadTimeout(300* 1000);
requestFactory.setConnectTimeout(300 *10000);
requestFactory.setReadTimeout(300* 10000);
RT = new RestTemplate(requestFactory);
}
// 解决乱码问题

@ -9,8 +9,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-system-biz</artifactId>
<dependencies>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
@ -45,7 +45,11 @@
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>4.7.0-0</version>
</dependency>
<!--词义匹配导入本地maven-->
<!--https://github.com/shibing624/similarity-->
<dependency>
@ -53,6 +57,7 @@
<artifactId>similarity</artifactId>
<version>1.1.6</version>
</dependency>
<!-- 积木报表 mongo redis 支持包
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>

@ -1,5 +1,6 @@
package org.jeecg.modules.api.controller;
import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -8,13 +9,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.enums.ModuleType;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*;
import org.jeecg.modules.message.entity.Req;
import org.jeecg.modules.ocr.entity.OcrIdentify;
import org.jeecg.modules.ocr.entity.OcrIdentifyDetail;
import org.jeecg.modules.ocr.entity.OcrRuleCheck;
@ -27,19 +33,32 @@ import org.jeecg.modules.ocr.utils.FileOUtils;
import org.jeecg.modules.ocr.utils.ImageUtils;
import org.jeecg.modules.ocr.dto.OcrIdentifyDTO;
import org.jeecg.modules.ocr.dto.OcrRuleCheckDTO;
import org.jeecg.modules.system.entity.SysFiles;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description
@ -66,6 +85,69 @@ public class ApiController {
@Value("${system.project.wlyCallback}")
private String wlyCallback;
@ApiOperation(value = "通用识别")
@RequestMapping("/getRequestIdsImage")
@Transactional
@ResponseBody
@AutoLog(value = "api接口-获取问题图片",logType = CommonConstant.LOG_TYPE_2,operateType=CommonConstant.OPERATE_TYPE_1)
public Result<?> getRequestIdsIamge(HttpServletRequest request,String dowPath,String zipPath, HttpServletResponse response) throws Exception {
String sss=dowPath;
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象
MultipartFile file = entity.getValue();
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<Req> list = ExcelImportUtil.importExcel(file.getInputStream(), Req.class, params);
log.info("导入");
ArrayList<OcrIdentify> ocrIdentifies = new ArrayList<>();
for(Req s:list){
LambdaQueryWrapper<OcrIdentify> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.like(OcrIdentify::getRequestId,s.getRequestId());
log.info("查询数据:{}",s.getRequestId());
List<OcrIdentify> list1 = ocrIdentifyService.list(lambdaQueryWrapper);
log.info("查询数据:{}",list1);
ocrIdentifies.addAll(list1);
}
List<String> collect = ocrIdentifies.stream().map(OcrIdentify::getId).collect(Collectors.toList());
List<OcrIdentifyDetail> list2 = ocrIdentifyDetailService.list(new LambdaQueryWrapper<OcrIdentifyDetail>().in(OcrIdentifyDetail::getIdentifyId, collect));
List<String> collect1 = list2.stream().map(OcrIdentifyDetail::getThumbnailImageUrl).distinct().collect(Collectors.toList());
for(String url:collect1){
File file2=new File(url);
String name = file2.getName();
String dow=dowPath+"/"+name;
File file3=new File(dow);
// if(!file3.exists()){
// file3.mkdir();
// }
try{
FileUtils.copyFile(file2,file3);
}catch (Exception e){
log.warn(e.getMessage());
}
}
File zip = ZipUtil.zip(sss, zipPath + "/" + new Date().getTime() + ".zip");
return Result.ok("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
String msg = e.getMessage();
log.error(msg, e);
//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.OK();
}
@ApiOperation(value = "通用识别")
@RequestMapping("/identify")
@Transactional
@ResponseBody

@ -0,0 +1,17 @@
package org.jeecg.modules.message.entity;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Title:
* @Description:
* @Author
* @Date 2023-11-09 22:40
* @Version V1.0
*/
@Data
public class Req {
@Excel(name= "requestId")
String requestId;
}

@ -24,6 +24,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -60,6 +61,7 @@ public class OcrSimulatorController{
List<String> imageList = images.toJavaList(String.class);
OcrIdentify ocrIdentify=new OcrIdentify();
ocrIdentify.setTaskSource("模拟实验");//模拟实验-场景识别
ocrIdentify.setTaskType(requestBody.getString("taskType"));
ocrIdentifyService.save(ocrIdentify);
List<OcrIdentifyDetail> ocrIdentifyDetailList=new ArrayList<>();
double nluTimeSum=0d;
@ -77,6 +79,15 @@ public class OcrSimulatorController{
ocrIdentifyDetail.setImageUrl(uploadFilePath + "/" + image);//图片地址
semanticRequestBody.put("img_path", uploadFilePath + "/" + image);
}
if(requestBody.getString("taskType")!=null&&requestBody.getString("taskType").equals("1699246961812586497")){
semanticRequestBody.put("scenes",1);
List<String> schema=new ArrayList<>();
schema.add("姓名");schema.add("年龄");schema.add("主要症状");schema.add("体征");schema.add("入院时主要症状和体征");
semanticRequestBody.put("schema",schema);
}else{
semanticRequestBody.put("scenes",0);
}
log.info("ocr识别模型请求参数{}",semanticRequestBody.toJSONString());
JSONObject semanticResponseJson = RestUtil.post(OcrConstant.api_test2_identify_url, semanticRequestBody);
//执行时间 调整小数点
Double nluTime = semanticResponseJson.getDouble("nlu_time");

@ -23,9 +23,9 @@ public class OcrRuleCheckDTO extends OcrRuleCheck {
@Excel(name = "元数据配置名称", width = 15)
private String metadataConfigName;
private String configRuleAdapter;
private Map<String,String> configRuleMap=new LinkedHashMap<>();
private Map<String,Object> configRuleMap=new LinkedHashMap<>();
private Map<String,String> fieldMap=new LinkedHashMap<>();
Map<String,Map<String,String>> configRuleTypeMap=new LinkedHashMap<>();
Map<String,Map<String,Object>> configRuleTypeMap=new LinkedHashMap<>();
}

@ -64,4 +64,7 @@ public class OcrRuleCheck implements Serializable {
@ApiModelProperty(value = "元数据配置id")
/*@Excel(name = "元数据配置id", width = 15)*/
private String metadataConfigId;
@ApiModelProperty(value = "是否并且或者表达式1不是2是")
private Integer type;
}

@ -33,7 +33,8 @@ import java.util.stream.Collectors;
*/
@Configuration
@Slf4j
public class HandleCallbacklnit implements ApplicationRunner {
public class HandleCallbacklnit {
//public class HandleCallbacklnit implements ApplicationRunner {
@Resource
RedisUtil redisUtil;
@ -48,7 +49,7 @@ public class HandleCallbacklnit implements ApplicationRunner {
/**
* @param args
*/
@Override
// @Override
@Async
public void run(ApplicationArguments args) throws UnknownHostException {
log.info("---------------------回调任务开启{}---------------------",enableHandleTask);

@ -34,7 +34,8 @@ import java.util.List;
*/
@Configuration
@Slf4j
public class HandleTaskInit implements ApplicationRunner {
public class HandleTaskInit{
// implements ApplicationRunner {
@Resource
IOcrIdentifyService ocrIdentifyService;
@Resource
@ -48,7 +49,7 @@ public class HandleTaskInit implements ApplicationRunner {
@Value("${system.project.enableHandleTask}")
private boolean enableHandleTask;
@Override
// @Override
@Async
public void run(ApplicationArguments args) throws Exception {
if(enableHandleTask){

@ -355,7 +355,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
@Override
@Async
public void updateOcrIdentifyStatus(String id, String status) {
log.info("id:{}",id);
//4.更新主任务状态
LambdaUpdateWrapper<OcrIdentify> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(OcrIdentify::getId, id);
@ -412,7 +411,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
OcrIdentifyDTO ocrIdentifyDTO = this.findById(id);
//=======规则检查配置
OcrRuleCheckDTO ocrRuleCheckVo = ocrIdentifyDTO.getOcrRuleCheckVo();
Map<String, Map<String, String>> configRuleTypeMap = ocrRuleCheckVo.getConfigRuleTypeMap();
Map<String, Map<String, Object>> configRuleTypeMap = ocrRuleCheckVo.getConfigRuleTypeMap();
//===================
}
@ -551,27 +550,11 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
* @param configRuleMap 1/0 map
* @param fieldMap map
*/
public Map<String, CheckSemanticModel> getCheckSemanticModelMap(Map<String, String> configRuleMap, Map<String, String> fieldMap, List<JSONObject> sourceJsonObjects) {
public Map<String, CheckSemanticModel> getCheckSemanticModelMap(Map<String, Object> configRuleMap, Map<String, String> fieldMap, List<JSONObject> sourceJsonObjects) {
if (configRuleMap!=null && CollectionUtils.isNotEmpty(configRuleMap.keySet())) {
//将 configRuleMap的 key 创建一个Set
Set<String> keySet = new HashSet<>(configRuleMap.keySet());
//循环keySet判断字段是否是缩写如果是缩写就把缩写的全称put一下
for (String s : keySet) {
String value = configRuleMap.get(s);
if ("hn".equals(s)) {
configRuleMap.put("hospitalName",value);
}else if("dn".equals(s)) {
configRuleMap.put("doctorName", value);
}else if("dmn".equals(s)) {
configRuleMap.put("departmentName", value);
}else if("tm".equals(s) || ("time".equals(s))) {
configRuleMap.put("time", value);
}else{
configRuleMap.put(s,value);
}
}
//缩写转全称
OcrJudgmentTools.abbreviationToFullName(configRuleMap);
}
Map<String, CheckSemanticModel> checkSemanticModelMap = new LinkedHashMap<>();
//校验正确的值
Map<String, String> inputMap = new LinkedHashMap<>();
@ -611,7 +594,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
copyEntity.setField(field);
//1/0
if (configRuleMap != null && configRuleMap.containsKey(field)) {
configRule = configRuleMap.get(field);
configRule =String.valueOf(configRuleMap.get(field));
copyEntity.setRuleInfo(configRule);
//端字段含义
fieldName = fieldMap.get(field);
@ -736,6 +719,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
List<OcrResultDTO> ocrResultDTOList = new ArrayList<>();
Date startDataCheckTime = new Date();
Map<String, Boolean> fieldRightMap = new LinkedHashMap<>();//存放 字段判断正确map
OcrRuleCheckDTO ocrRuleCheckVo = ocrRuleCheckService.findById(simulateChecksVO.getRuleCheckId());
for (OcrIdentifyDetail ocrIdentifyDetail : identifyDetailList) {
i1++;
String semanticResultJson = ocrIdentifyDetail.getSemanticResult();
@ -785,11 +769,17 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
ocrIdentifyDetail.setThumbnailImageUrl(outputImagePath);
}*/
//============================绘制虚线
// JSONObject semanticResult2 = semanticResult.getJSONObject("semantic_result");
// String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
// //判断新目录是否存在,不存在则新建
// FileOUtils.folderCreate(fileUrl);
// String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
JSONObject semanticResult2 = semanticResult.getJSONObject("semantic_result");
String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
// String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
String fileUrl = imgPath.substring(0, i);
//判断新目录是否存在,不存在则新建
FileOUtils.folderCreate(fileUrl);
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
String outputImagePath = fileUrl + "\\"+imgPath.substring(i + 1, imgPath.length());
if (semanticResult2!=null) {
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult2);
boolean hasPoints=true;
@ -807,8 +797,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
}
//============================
}
OcrRuleCheckDTO ocrRuleCheckVo = ocrRuleCheckService.findById(simulateChecksVO.getRuleCheckId());
Map<String, CheckSemanticModel> checkSemanticModelMap = getCheckSemanticModelMap(ocrRuleCheckVo.getConfigRuleMap(), ocrRuleCheckVo.getFieldMap(), sourceJson);
String text = null;//ocr 识别的文本
Double probability = 0d;
@ -911,62 +899,119 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
}
}
if (ocrArray.size() > 0) {
for (JSONObject ocrItem : ocrArray) {
text = null;
text = ocrItem.getString("text");//ocr 识别的文本
probability = ocrItem.getDouble("probability");//置信度
if ("101".equals(ruleInfo)) {
if (StringUtils.isBlank(text) || StringUtils.isBlank(inputText)) {
//没识别值
mapPutIfTrue(fieldRightMap, field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数不判断", true, ruleInfo);
} else {
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
if(ocrRuleCheckVo.getType()==null||ocrRuleCheckVo.getType()==1){
for (JSONObject ocrItem : ocrArray) {
text = null;
text = ocrItem.getString("text");//ocr 识别的文本
probability = ocrItem.getDouble("probability");//置信度
if ("101".equals(ruleInfo)) {
if (StringUtils.isBlank(text) || StringUtils.isBlank(inputText)) {
//没识别值
mapPutIfTrue(fieldRightMap, field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, "101");
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数不判断", true, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
mapPutIfTrue(fieldRightMap, field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, "101");
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
}
}
} else {
if (StringUtils.isBlank(text)) {
//ocr识别参数为空不通过
rMessage.append(value.getFieldName()).append("参数未获取到结果<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数未获取到结果", false, ruleInfo);
} else if (StringUtils.isBlank(inputText)) {
//没有输入值.
fieldRightMap.put(field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "没有输入值", false, ruleInfo);
} else if ("0".equals(ruleInfo)) {
//不必校验,有识别到就行,通过
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, ruleInfo);
} else if (Double.parseDouble(ruleInfo) >= 1 && Double.parseDouble(ruleInfo) <= 99) {
//在1~99之间根据精准度匹配
double v = StrCharUtil.similarityRatio(inputText, text);
if (v >= Double.parseDouble(ruleInfo)) {
//准确度 可靠
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
}
} else if ("100".equals(ruleInfo)) {
//必定验证参数,必须有值且匹配
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
}
}
}
} else {
if (StringUtils.isBlank(text)) {
//ocr识别参数为空不通过
rMessage.append(value.getFieldName()).append("参数未获取到结果<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数未获取到结果", false, ruleInfo);
} else if (StringUtils.isBlank(inputText)) {
//没有输入值.
fieldRightMap.put(field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "没有输入值", false, ruleInfo);
} else if ("0".equals(ruleInfo)) {
//不必校验,有识别到就行,通过
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, ruleInfo);
} else if (Double.parseDouble(ruleInfo) >= 1 && Double.parseDouble(ruleInfo) <= 99) {
//在1~99之间根据精准度匹配
double v = StrCharUtil.similarityRatio(inputText, text);
if (v >= Double.parseDouble(ruleInfo)) {
//准确度 可靠
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, ruleInfo);
}
} else if (ocrRuleCheckVo.getType()!= null&&ocrRuleCheckVo.getType()==2) {
for (JSONObject ocrItem : ocrArray) {
text = null;
text = ocrItem.getString("text");//ocr 识别的文本
probability = ocrItem.getDouble("probability");//置信度
if ("101".equals(ruleInfo)) {
if (StringUtils.isBlank(text) || StringUtils.isBlank(inputText)) {
//没识别值
mapPutIfTrue(fieldRightMap, field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数不判断", true, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
mapPutIfTrue(fieldRightMap, field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, "101");
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
}
}
} else if ("100".equals(ruleInfo)) {
//必定验证参数,必须有值且匹配
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
} else {
if (StringUtils.isBlank(text)) {
//ocr识别参数为空不通过
rMessage.append(value.getFieldName()).append("参数未获取到结果<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, null, probability, imgPath, value.getFieldName() + "参数未获取到结果", false, ruleInfo);
} else if (StringUtils.isBlank(inputText)) {
//没有输入值.
fieldRightMap.put(field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "没有输入值", false, ruleInfo);
} else if ("0".equals(ruleInfo)) {
//不必校验,有识别到就行,通过
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, ruleInfo);
} else if (Double.parseDouble(ruleInfo) >= 1 && Double.parseDouble(ruleInfo) <= 99) {
//在1~99之间根据精准度匹配
double v = StrCharUtil.similarityRatio(inputText, text);
//准确度 可靠
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
} else if ("100".equals(ruleInfo)) {
//必定验证参数,必须有值且匹配
double v = StrCharUtil.similarityRatio(inputText, text);
if (text.equals(inputText)) {
fieldRightMap.put(field, true);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "", true, v, ruleInfo);
} else {
rMessage.append(value.getFieldName()).append("参数不匹配<br>");
mapPutIfTrue(fieldRightMap, field, false);
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, value.getFieldName() + "参数不匹配", false, v, ruleInfo);
}
}
}
}
@ -1006,9 +1051,20 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
//没有匹配结果
responseBody.put("taskResult",1);
}else{
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);//匹配成功或失败
if(ocrRuleCheckVo.getType()==null||ocrRuleCheckVo.getType()==1){
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);//匹配成功或失败
}else if(ocrRuleCheckVo.getType()!=null&&ocrRuleCheckVo.getType()==2){
log.info(ocrResultDTOList.toString());
String configRule = ocrRuleCheckVo.getConfigRule();
Map<String,Object> params=new HashMap<>();
for(OcrResultDTO ocrResultDTO:ocrResultDTOList){
params.put(ocrResultDTO.getTag(),ocrResultDTO.getTextRate());
}
Boolean rest=OcrJudgmentTools.judment(configRule,params);
responseBody.put("taskResult",rest?0:1);
}
Set<String> haveRateTagList = ocrResultDTOList.stream().filter(o -> o.getTextRate() > 0).map(OcrResultDTO::getTag).collect(Collectors.toSet());
List<OcrResultDTO> newResultDTOList=new ArrayList<>();
//过滤掉0的值
@ -1136,10 +1192,11 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
}*/
//============================绘制虚线
JSONObject semanticResult2 = semanticResult.getJSONObject("semantic_result");
String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
// String fileUrl = "/data/ocrImage/drawDashed" + imgPath.substring(0, i);
String fileUrl = imgPath.substring(0, i);
//判断新目录是否存在,不存在则新建
FileOUtils.folderCreate(fileUrl);
String outputImagePath = fileUrl + imgPath.substring(i + 1, imgPath.length());
String outputImagePath = fileUrl + "\\"+imgPath.substring(i + 1, imgPath.length());
if (semanticResult2!=null) {
List<List<Point>> resultToPoints = ImageUtils.semanticResultToPoints(semanticResult2);
boolean hasPoints=true;

@ -18,6 +18,8 @@ import org.jeecg.modules.ocr.mapper.OcrMetadataConfigMapper;
import org.jeecg.modules.ocr.mapper.OcrRuleCheckMapper;
import org.jeecg.modules.ocr.service.IOcrRuleCheckDetailService;
import org.jeecg.modules.ocr.service.IOcrRuleCheckService;
import org.jeecg.modules.ocr.utils.OcrJudgmentTools;
import org.jeecg.modules.ocr.utils.StrCharUtil;
import org.jeecg.modules.ocr.vo.SaveOcrRuleCheckVO;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
@ -39,10 +41,6 @@ import java.util.stream.Collectors;
*/
@Service
public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, OcrRuleCheck> implements IOcrRuleCheckService {
@Resource
IOcrRuleCheckDetailService ocrRuleCheckDetailService;
@Resource
OcrMetadataConfigMapper ocrMetadataConfigMapper;
@Resource
OcrMetadataConfigDetailMapper ocrMetadataConfigDetailMapper;
@Override
@ -62,14 +60,31 @@ public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, Ocr
public void saveModelBatch(List<SaveOcrRuleCheckVO> saveOcrRuleCheckVOS) {
for (SaveOcrRuleCheckVO saveOcrRuleCheckVO : saveOcrRuleCheckVOS) {
OcrRuleCheck ocrRuleCheck=new OcrRuleCheck();
if (StringUtils.isNotBlank(saveOcrRuleCheckVO.getConfigRule())) {
if (saveOcrRuleCheckVO.getConfigRule().contains("isrule=1") && saveOcrRuleCheckVO.getConfigRule().replace("isrule=1","").length()>0) {
throw new JeecgBootException("isrule=1规则只可单独使用");
if(saveOcrRuleCheckVO.getType()==null||saveOcrRuleCheckVO.getType()==1){
if (StringUtils.isNotBlank(saveOcrRuleCheckVO.getConfigRule())) {
if (saveOcrRuleCheckVO.getConfigRule().contains("isrule=1") && saveOcrRuleCheckVO.getConfigRule().replace("isrule=1","").length()>0) {
throw new JeecgBootException("isrule=1规则只可单独使用");
}
}
saveOcrRuleCheckVO.setType(1);
}else if(saveOcrRuleCheckVO.getType()==2){
String configRule = saveOcrRuleCheckVO.getConfigRule();
String metadataConfigId = saveOcrRuleCheckVO.getMetadataConfigId();
//获取规则配置元字段
List<OcrMetadataConfigDetail> ocrMetadataConfigDetails = ocrMetadataConfigDetailMapper.selectList(new LambdaQueryWrapper<OcrMetadataConfigDetail>().eq(OcrMetadataConfigDetail::getMetadataConfigId, metadataConfigId));
Map<String,Object> params=new HashMap<>();
for(OcrMetadataConfigDetail configDetail:ocrMetadataConfigDetails){
String fieldName = configDetail.getFieldName();
params.put(fieldName,1);
}
OcrJudgmentTools.fullNameToAbbreviation(params);
//做下表达式校验,看表达式是否正确,如果不正确这个方法里面会抛出异常如果正确就继续入库
OcrJudgmentTools.judment(configRule, params);
}
ocrRuleCheck.setConfigRule(saveOcrRuleCheckVO.getConfigRule());
ocrRuleCheck.setMetadataConfigId(saveOcrRuleCheckVO.getMetadataConfigId());
ocrRuleCheck.setConfigName(saveOcrRuleCheckVO.getConfigName());
ocrRuleCheck.setType(saveOcrRuleCheckVO.getType());
this.save(ocrRuleCheck);
}
}
@ -333,39 +348,45 @@ public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, Ocr
OcrRuleCheckDTO ocrRuleCheckVo = baseMapper.findById(id);
AssertUtils.notNull(ocrRuleCheckVo,id+"-规则检查配置不存在");
if (StringUtils.isNotBlank(ocrRuleCheckVo.getConfigRule())) {
String configRule = ocrRuleCheckVo.getConfigRule();
//TODO {key(&,||):{key(字段):value(1/0)}}
Map<String,Map<String,String>> configRuleTypeMap=new LinkedHashMap<>();
if (configRule.contains(OcrConstant.ruleCheckOrChar)) {
// ||
String[] orSplit = configRule.split(OcrConstant.ruleCheckOrChar);
Map<String,String> configRuleMap=new LinkedHashMap<>();
String field=null;String fieldValue=null;
for (String s : orSplit) {
configRuleMap=new LinkedHashMap<>();
String[] split1 = s.split(OcrConstant.ruleCheckValueRightChar);
if (split1.length<=1) {
continue;
if(ocrRuleCheckVo.getType()==null||ocrRuleCheckVo.getType()==1){
String configRule = ocrRuleCheckVo.getConfigRule();
//TODO {key(&,||):{key(字段):value(1/0)}}
Map<String,Map<String,Object>> configRuleTypeMap=new LinkedHashMap<>();
if (configRule.contains(OcrConstant.ruleHz)) {
// ||
String[] orSplit = configRule.split(OcrConstant.ruleHz);
Map<String,Object> configRuleMap=new LinkedHashMap<>();
String field=null;String fieldValue=null;
for (String s : orSplit) {
configRuleMap=new LinkedHashMap<>();
String[] split1 = s.split(OcrConstant.ruleCheckValueRightChar);
if (split1.length<=1) {
continue;
}
configRuleMap.put(split1[0],split1[1]);
}
configRuleMap.put(split1[0],split1[1]);
}
configRuleTypeMap.put(OcrConstant.ruleCheckOrChar,configRuleMap);
}else {
//&
String[] split = configRule.split(OcrConstant.ruleCheckSplitChar);
//将 `配置规则` 转成 map
Map<String,String> configRuleMap=new LinkedHashMap<>();
for (String s : split) {
String[] split1 = s.split(OcrConstant.ruleCheckValueRightChar);
if (split1.length<=1) {
continue;
configRuleTypeMap.put(OcrConstant.ruleHz,configRuleMap);
}else {
//&
String[] split = configRule.split(OcrConstant.ruleCheckSplitChar);
//将 `配置规则` 转成 map
Map<String,Object> configRuleMap=new LinkedHashMap<>();
for (String s : split) {
String[] split1 = s.split(OcrConstant.ruleCheckValueRightChar);
if (split1.length<=1) {
continue;
}
configRuleMap.put(split1[0],split1[1]);
}
configRuleMap.put(split1[0],split1[1]);
ocrRuleCheckVo.setConfigRuleMap(configRuleMap);
configRuleTypeMap.put(OcrConstant.ruleCheckSplitChar,configRuleMap);
}
ocrRuleCheckVo.setConfigRuleMap(configRuleMap);
configRuleTypeMap.put(OcrConstant.ruleCheckSplitChar,configRuleMap);
ocrRuleCheckVo.setConfigRuleTypeMap(configRuleTypeMap);
}else if(ocrRuleCheckVo.getType()!=null||ocrRuleCheckVo.getType()==2){
String configRule = ocrRuleCheckVo.getConfigRule();
Map<String,Object> restMap= StrCharUtil.strSplits(configRule);
ocrRuleCheckVo.setConfigRuleMap(restMap);
}
ocrRuleCheckVo.setConfigRuleTypeMap(configRuleTypeMap);
}
if (StringUtils.isNotBlank(ocrRuleCheckVo.getMetadataConfigId())) {
String metadataConfigId = ocrRuleCheckVo.getMetadataConfigId();
@ -379,4 +400,5 @@ public class OcrRuleCheckServiceImpl extends ServiceImpl<OcrRuleCheckMapper, Ocr
return ocrRuleCheckVo;
}
}

@ -27,26 +27,45 @@ public class ImageUtils {
Java使ImageIOThumbnailsJava Advanced Imaging APIJAI使ImageIO
*/
public static void main(String[] args) throws FileNotFoundException {
String sourceImagePath = "C:\\Users\\Denim\\Desktop\\aabebdf71887c6c2707c65211cac2d3a.jpeg";
String outputImagePath = "C:\\Users\\Denim\\Desktop\\ds-aabebdf71887c6c2707c65211cac2d3a.jpeg";
//compressImage(sourceImagePath,outputImagePath,0.25f,0.25f);
List<Point> points = new ArrayList<>();
points.add(new Point(9, 2924));
points.add(new Point(107, 2924));
points.add(new Point(107, 2959));
points.add(new Point(9, 2959));
List<Point> points2 = new ArrayList<>();
points2.add(new Point(1282, 1576));
points2.add(new Point(2764, 1594));
points2.add(new Point(2763, 1671));
points2.add(new Point(1281, 1653));
List<List<Point>> pointList = new ArrayList<>();
pointList.add(points);
pointList.add(points2);
//drawDashedRectangleOnImages("http://47.103.213.109:8072/files/nfs/ocr/shared_directory/fdd50089f33e4b4391b8c88b6299735b/a86aff69fc3ff5397d038b4dbcde6165.jpeg", pointList, "C:\\Users\\Denim\\Desktop\\output_image.png","red");
drawDashedRectangleOnImages(sourceImagePath, pointList, "C:\\Users\\Denim\\Desktop\\output_image.png","green");
// String sourceImagePath = "C:\\Users\\Denim\\Desktop\\aabebdf71887c6c2707c65211cac2d3a.jpeg";
// String outputImagePath = "C:\\Users\\Denim\\Desktop\\ds-aabebdf71887c6c2707c65211cac2d3a.jpeg";
// //compressImage(sourceImagePath,outputImagePath,0.25f,0.25f);
// List<Point> points = new ArrayList<>();
// points.add(new Point(9, 2924));
// points.add(new Point(107, 2924));
// points.add(new Point(107, 2959));
// points.add(new Point(9, 2959));
// List<Point> points2 = new ArrayList<>();
// points2.add(new Point(1282, 1576));
// points2.add(new Point(2764, 1594));
// points2.add(new Point(2763, 1671));
// points2.add(new Point(1281, 1653));
// List<List<Point>> pointList = new ArrayList<>();
// pointList.add(points);
// pointList.add(points2);
// //drawDashedRectangleOnImages("http://47.103.213.109:8072/files/nfs/ocr/shared_directory/fdd50089f33e4b4391b8c88b6299735b/a86aff69fc3ff5397d038b4dbcde6165.jpeg", pointList, "C:\\Users\\Denim\\Desktop\\output_image.png","red");
// drawDashedRectangleOnImages(sourceImagePath, pointList, "C:\\Users\\Denim\\Desktop\\output_image.png","green");
String sourceImagePath = "D:\\workspace\\ocr\\data\\upFiles\\医院名称识别不到_1697812202041.png";
try {
BufferedImage originalImage = ImageIO.read(new File(sourceImagePath));
// 设置放大后的图片尺寸
int newWidth = originalImage.getWidth() * 3;
int newHeight = originalImage.getHeight() * 3;
BufferedImage bufferedImage = zoomImage(originalImage, newWidth, newHeight);
ImageIO.write(bufferedImage, "png", new File("D:\\workspace\\ocr\\data\\医院名称识别不到_1697812202041.png"));
System.out.println("图片放大成功!");
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static BufferedImage zoomImage(BufferedImage originalImage, int newWidth, int newHeight) {
BufferedImage zoomedImage = new BufferedImage(newWidth, newHeight, originalImage.getType());
Graphics2D g = zoomedImage.createGraphics();
g.drawImage(originalImage, 0, 0, newWidth, newHeight, null);
g.dispose();
return zoomedImage;
}
/**
*
*

@ -0,0 +1,93 @@
package org.jeecg.modules.ocr.utils;
import org.jeecg.common.exception.JeecgBootException;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @Title:
* @Description:
* @Author
* @Date 2023-10-13 17:47
* @Version V1.0
*/
public class OcrJudgmentTools {
public static void main(String[] args) {
Map<String,Object> engine =new HashMap<>();
String str="value>5&&st==\"test\"&&(state==\"正常\"||state==\"不正常\")";
engine.put("value",6);
engine.put("state","正常");
engine.put("st","test");
Boolean judment = judment(str, engine);
System.out.println(judment);
}
public static ScriptEngine getEngine(){
ScriptEngineManager manager=new ScriptEngineManager();
return manager.getEngineByName("nashorn");
}
public static Boolean judment(String expression, Map<String,Object> params){
Boolean eval=false;
ScriptEngine engine = getEngine();
for(String key:params.keySet()){
engine.put(key,params.get(key));
}
try {
eval =(Boolean) engine.eval(expression);
} catch (ScriptException e) {
throw new JeecgBootException("条件表达式配置错误请检查");
}
return eval;
}
/***
*
* @return
*/
public static void abbreviationToFullName(Map<String, Object> configRuleMap){
Set<String> keySet = new HashSet<>(configRuleMap.keySet());
//循环keySet判断字段是否是缩写如果是缩写就把缩写的全称put一下
for (String s : keySet) {
Object value = configRuleMap.get(s);
if ("hn".equals(s)) {
configRuleMap.put("hospitalName",value);
}else if("dn".equals(s)) {
configRuleMap.put("doctorName", value);
}else if("dmn".equals(s)) {
configRuleMap.put("departmentName", value);
}else if("tm".equals(s) || ("time".equals(s))) {
configRuleMap.put("time", value);
}else{
configRuleMap.put(s,value);
}
}
}
/***
*
* @return
*/
public static void fullNameToAbbreviation(Map<String, Object> configRuleMap){
Set<String> keySet = new HashSet<>(configRuleMap.keySet());
//循环keySet判断字段是否是缩写如果是缩写就把缩写的全称put一下
for (String s : keySet) {
Object value = configRuleMap.get(s);
if ("hospitalName".equals(s)) {
configRuleMap.put("hn",value);
}else if("doctorName".equals(s)) {
configRuleMap.put("dn", value);
}else if("departmentName".equals(s)) {
configRuleMap.put("dmn", value);
}else if("tm".equals(s) || ("time".equals(s))) {
configRuleMap.put("time", value);
}else{
configRuleMap.put(s,value);
}
}
}
}

@ -1,8 +1,13 @@
package org.jeecg.modules.ocr.utils;
import org.jeecg.common.constant.OcrConstant;
import org.xm.Similarity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
@ -10,6 +15,67 @@ import java.math.BigDecimal;
* @Date 2023/8/11 13:50
*/
public class StrCharUtil {
public static void main(String[] args) {
String configRule="hospitalName>=40&&(departmentName==0||doctorName==0)";
Map<String, Object> stringObjectMap = strSplits(configRule);
}
/**
*
*/
public static Map<String,Object> strSplits(String configRule){
//去除不需要的字符如 括号,叹号
configRule=configRule.replaceAll(" ","").replaceAll(OcrConstant.ruleZkh,"").replaceAll(OcrConstant.ruleYkh,"");
if(configRule.contains(OcrConstant.ruleTh+OcrConstant.ruleCheckValueRightChar)){
configRule=configRule.replaceAll(OcrConstant.ruleTh+OcrConstant.ruleCheckValueRightChar,"~"+OcrConstant.ruleCheckValueRightChar);//如果有!=那就替换为b=
}else{
configRule=configRule.replaceAll(OcrConstant.ruleTh,"");
}
if(configRule.contains(OcrConstant.ruleDyh+OcrConstant.ruleCheckValueRightChar)){
configRule=configRule.replaceAll(OcrConstant.ruleDyh+OcrConstant.ruleCheckValueRightChar,"dydy");
}
if(configRule.contains(OcrConstant.ruleDyh+OcrConstant.ruleCheckValueRightChar)){
configRule=configRule.replaceAll(OcrConstant.ruleXyh+OcrConstant.ruleCheckValueRightChar,"xydy");
}
//切割符组装 放入list中
List<String> splits=new ArrayList<>();
splits.add(OcrConstant.ruleDyh);
splits.add(OcrConstant.ruleXyh);
splits.add("xydy");
splits.add("dydy");
splits.add(OcrConstant.ruleCheckValueRightChar+OcrConstant.ruleCheckValueRightChar);
splits.add("~"+OcrConstant.ruleCheckValueRightChar);
if(configRule.contains(OcrConstant.ruleHz)){
configRule=configRule.replaceAll("\\|\\|",OcrConstant.ruleBq);
}
String[] strs = configRule.split(OcrConstant.ruleBq);
Map<String,Object> map=new HashMap<>();
for(String strss:strs){
strSplits(strss,splits,map);
}
return map;
}
public static void strSplits(String strs, List<String> splits,Map<String,Object> rest){
for(String split:splits){
if(strs.contains(split)){
String[] split1 = strs.split(split);
boolean sdf=false;
for(String s:split1){
for(String sf:splits){
if(!s.contains(sf)){
sdf=true;
}
}
}
if(sdf){
rest.put(split1[0],split1[1]);
}else{
for(String str22:split1){
strSplits(str22,splits,rest);
}
}
}
}
}
/**
* ()
@ -176,15 +242,4 @@ public class StrCharUtil {
return v;*/
}
public static void main(String[] args) {
String strA = "河北唐山市协和医院";
String strB = "河北省唐山协和医院";
System.out.println(similarityRatio(strA,strB));
//System.out.println(longestCommonSubstringNoOrder(strA, strB));
//System.out.println(SimilarDegree(strA, strB));
//System.out.println(compare(strA, strB));
//System.out.println(similarityRatio(strA, strB));
}
}

@ -37,6 +37,9 @@ public class SaveOcrRuleCheckVO implements Serializable {
@ApiModelProperty(value = "元数据配置名称")
@Excel(name = "元数据配置名称", width = 15)
private String metadataConfigName;
@ApiModelProperty(value = "并且或者组合规则,1不是2是")
@Excel(name = "是否为并且或者组合规则", width = 15)
private Integer type;
/**选择的元数据明细id*/
//@ApiModelProperty(value = "选择的元数据明细id")
//public List<String> metadataConfigDetailIdList=new ArrayList<>();

@ -131,13 +131,13 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://47.103.213.109:3306/ocr?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: Wang5322570..
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# url: jdbc:mysql://47.103.213.109:3306/ocr?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root
# password: root
# password: Wang5322570..
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/ocr?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
# driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
@ -148,9 +148,13 @@ spring:
#redis 配置
redis:
database: 3
host: 47.103.213.109
host: 127.0.0.1
port: 6379
password: ''
#tess4j
tess4j:
data-path: D:\workspace\ocr\data\tess4jdata
language: chi_sim
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
@ -185,9 +189,9 @@ jeecg:
app: http://localhost:8051
path:
#文件上传根目录 设置
upload: /data/ocr/upFiles
upload: D:\workspace\ocr\data\upFiles
#webapp文件路径
webapp: /opt/webapp
webapp: D://opt/webapp
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置
@ -299,5 +303,6 @@ third-app:
system:
project:
env: customer_test
enableHandleTask: false
fileReviewUrlPrefix: http://47.103.213.109:8072/files
enableHandleTask: true
fileReviewUrlPrefix: http://localhost:8071/files
wlyCallback: https://hyycsozs.prevailcloud.com/api/task/image/ocr/callback

@ -1,5 +1,5 @@
server:
port: 8020
port: 8088
tomcat:
max-swallow-size: -1
error:
@ -152,6 +152,9 @@ spring:
# host: 47.103.213.109
port: 6379
password: ''
tess4j:
data-path: D:\workspace\ocr\data\tess4jdata
language: chi_sim
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml

Loading…
Cancel
Save