|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.ocr.service.impl;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -62,6 +63,8 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
RedisUtil redisUtil;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
IOcrIdentifyCallbackLogService ocrIdentifyCallbackLogService;
|
|
|
|
IOcrIdentifyCallbackLogService ocrIdentifyCallbackLogService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private IOcrIdentifyService ocrIdentifyService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public OcrIdentifyDTO findById(String id) {
|
|
|
|
public OcrIdentifyDTO findById(String id) {
|
|
|
@ -415,7 +418,6 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
public void callbackWly(String ocrIdentifyId) {
|
|
|
|
public void callbackWly(String ocrIdentifyId) {
|
|
|
|
OcrIdentifyCallbackLog ocrIdentifyCallbackLog = new OcrIdentifyCallbackLog();
|
|
|
|
OcrIdentifyCallbackLog ocrIdentifyCallbackLog = new OcrIdentifyCallbackLog();
|
|
|
|
ocrIdentifyCallbackLog.setIdentifyId(ocrIdentifyId);
|
|
|
|
ocrIdentifyCallbackLog.setIdentifyId(ocrIdentifyId);
|
|
|
|
|
|
|
|
|
|
|
|
Date date = new Date();
|
|
|
|
Date date = new Date();
|
|
|
|
ocrIdentifyCallbackLog.setCreateTime(date);
|
|
|
|
ocrIdentifyCallbackLog.setCreateTime(date);
|
|
|
|
LambdaUpdateWrapper<OcrIdentify> updateWrapper = new LambdaUpdateWrapper<OcrIdentify>();
|
|
|
|
LambdaUpdateWrapper<OcrIdentify> updateWrapper = new LambdaUpdateWrapper<OcrIdentify>();
|
|
|
@ -426,7 +428,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(ocrIdentifyId);
|
|
|
|
List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(ocrIdentifyId);
|
|
|
|
ocrIdentifyCallbackLog.setStartTime(date);
|
|
|
|
ocrIdentifyCallbackLog.setStartTime(date);
|
|
|
|
boolean b = CallBackWlyUtils.callbackWly(ocrIdentify, identifyDetailList);
|
|
|
|
boolean b = CallBackWlyUtils.callbackWly(ocrIdentify, identifyDetailList);
|
|
|
|
ocrIdentifyCallbackLog.setStatus(b?1:0);
|
|
|
|
ocrIdentifyCallbackLog.setStatus(b?1:0);//0-失败,1-成功
|
|
|
|
ocrIdentifyCallbackLog.setEndTime(new Date());
|
|
|
|
ocrIdentifyCallbackLog.setEndTime(new Date());
|
|
|
|
ocrIdentifyCallbackLogService.save(ocrIdentifyCallbackLog);
|
|
|
|
ocrIdentifyCallbackLogService.save(ocrIdentifyCallbackLog);
|
|
|
|
if (b) {
|
|
|
|
if (b) {
|
|
|
@ -903,7 +905,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
} else if (StringUtils.isBlank(inputText)) {
|
|
|
|
} else if (StringUtils.isBlank(inputText)) {
|
|
|
|
//没有输入值.
|
|
|
|
//没有输入值.
|
|
|
|
fieldRightMap.put(field, false);
|
|
|
|
fieldRightMap.put(field, false);
|
|
|
|
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "没有输入值不做匹配", false, ruleInfo);
|
|
|
|
ocrResultAdd(ocrResultDTOList, value.getFieldName(), field, inputText, text, probability, imgPath, "没有输入值", false, ruleInfo);
|
|
|
|
} else if ("0".equals(ruleInfo)) {
|
|
|
|
} else if ("0".equals(ruleInfo)) {
|
|
|
|
//不必校验,有识别到就行,通过
|
|
|
|
//不必校验,有识别到就行,通过
|
|
|
|
fieldRightMap.put(field, true);
|
|
|
|
fieldRightMap.put(field, true);
|
|
|
@ -1221,4 +1223,17 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
|
|
|
|
return taskList;
|
|
|
|
return taskList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public long calculateTimeDifference(String taskName) {
|
|
|
|
|
|
|
|
QueryWrapper<OcrIdentify> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper.eq("taskName", taskName).orderByDesc("createTime").last("LIMIT 1");
|
|
|
|
|
|
|
|
OcrIdentify lastIdentify = ocrIdentifyService.getOne(queryWrapper);
|
|
|
|
|
|
|
|
if (lastIdentify != null) {
|
|
|
|
|
|
|
|
Date lastCreateTime = lastIdentify.getCreateTime();
|
|
|
|
|
|
|
|
Date currentTime = new Date();
|
|
|
|
|
|
|
|
return (currentTime.getTime() - lastCreateTime.getTime()) / 1000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 11; // 如果没有找到数据,返回默认值
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|