|
|
|
@ -17,10 +17,7 @@ import org.jeecg.module.custom.ocr.dataDao.TaskMapper;
|
|
|
|
|
import org.jeecg.module.custom.ocr.dataobject.*;
|
|
|
|
|
import org.jeecg.module.custom.ocr.service.OcrPictureInfoService;
|
|
|
|
|
import org.jeecg.module.custom.ocr.service.OcrPictureService;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.ApiHelper;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.HashCompareUtil;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.NameConverterUtil;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.StringUtils;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.*;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.httputil.HttpClient;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.httputil.HttpMethod;
|
|
|
|
|
import org.jeecg.module.custom.ocr.utils.httputil.HttpParamers;
|
|
|
|
@ -32,10 +29,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
@ -157,6 +151,12 @@ public class DuplicateTaskRunner {
|
|
|
|
|
|
|
|
|
|
Set<Long> pictureIds = Sets.newHashSet();
|
|
|
|
|
List<Long> taskNoList = tasks.stream().map(Task::getTaskNo).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, Task> taskMap = tasks.stream()
|
|
|
|
|
.collect(Collectors.toMap(
|
|
|
|
|
Task::getTaskNo, // Key mapper - taskNo
|
|
|
|
|
task -> task, // Value mapper - the task itself
|
|
|
|
|
(existing, replacement) -> existing // Merge function - keep the existing one if duplicates
|
|
|
|
|
));
|
|
|
|
|
List<OcrPictureInfo> pictures = ocrPictureInfoMapper.selectByTaskNos(taskNoList);
|
|
|
|
|
if (!CollectionUtils.isEmpty(pictures)) {
|
|
|
|
|
pictures = pictures.stream().filter(item -> queryConfig.getValidateColumn().contains(item.getType())).collect(Collectors.toList());
|
|
|
|
@ -175,9 +175,19 @@ public class DuplicateTaskRunner {
|
|
|
|
|
double similarityValue = Double.parseDouble(similarityScore);
|
|
|
|
|
if (!pictureIds.contains(first.getId()) && similarityValue > queryConfig.getConfidenceLevel()) {
|
|
|
|
|
TaskCompletionRequest.HisPictureRepeat hisPictureRepeat = new TaskCompletionRequest.HisPictureRepeat();
|
|
|
|
|
Task task = taskMap.get(first.getTaskNo());
|
|
|
|
|
hisPictureRepeat.setHisTaskId(task.getTaskId());
|
|
|
|
|
hisPictureRepeat.setHisRepeatSubmitTime(task.getSubmitTime());
|
|
|
|
|
Map<String, String> stringStringMap = JsonUtil.jsonToMap(task.getDynamicFields());
|
|
|
|
|
hisPictureRepeat.setHisRepeatFillUserName(stringStringMap.get("fillUserName"));
|
|
|
|
|
hisPictureRepeat.setHisRepeatSignAccountName(stringStringMap.get("signAccountName"));
|
|
|
|
|
hisPictureRepeat.setHisRepeatTask(JSONObject.toJSONString(task));
|
|
|
|
|
|
|
|
|
|
hisPictureRepeat.setHisTaskNo(first.getTaskNo());
|
|
|
|
|
hisPictureRepeat.setHisRepeatImgUrl(first.getImageUrl());
|
|
|
|
|
hisPictureRepeat.setHisRepeatImgNo(first.getId());
|
|
|
|
|
hisPictureRepeat.setHisRepeatImgName(first.getImgName());
|
|
|
|
|
hisPictureRepeat.setHisRepeatTaskId(first.getTaskNo());
|
|
|
|
|
pictureIds.add(first.getId());
|
|
|
|
|
historyLists.add(hisPictureRepeat);
|
|
|
|
|
}
|
|
|
|
@ -230,7 +240,7 @@ public class DuplicateTaskRunner {
|
|
|
|
|
List<TaskCompletionRequest.PictureRepeat> pictureRepeatList = pictures.stream()
|
|
|
|
|
.map(p -> {
|
|
|
|
|
TaskCompletionRequest.PictureRepeat repeat = new TaskCompletionRequest.PictureRepeat();
|
|
|
|
|
repeat.setImgNo(p.getId());
|
|
|
|
|
repeat.setImgName(p.getImgName());
|
|
|
|
|
repeat.setImgUrl(p.getImageUrl());
|
|
|
|
|
repeat.setDynamicFields(new HashMap<>()); // 动态字段待补充
|
|
|
|
|
repeat.setHisPictureRepeatList(historyLists);
|
|
|
|
|