From 8cd5e831220cd4f6e18b72667bc3bf27fb15dc25 Mon Sep 17 00:00:00 2001 From: Vincent <19330835921@163.com> Date: Fri, 27 Jun 2025 14:16:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E9=87=8D=E5=A4=8D=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E9=9B=86=E5=90=88=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/ocr/api/thread/DuplicateTaskRunner.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jeecg-module-custom/src/main/java/org/jeecg/module/custom/ocr/api/thread/DuplicateTaskRunner.java b/jeecg-module-custom/src/main/java/org/jeecg/module/custom/ocr/api/thread/DuplicateTaskRunner.java index db0aa2c..40b1000 100644 --- a/jeecg-module-custom/src/main/java/org/jeecg/module/custom/ocr/api/thread/DuplicateTaskRunner.java +++ b/jeecg-module-custom/src/main/java/org/jeecg/module/custom/ocr/api/thread/DuplicateTaskRunner.java @@ -224,6 +224,15 @@ public class DuplicateTaskRunner { private boolean notifyTaskCompletion(String taskNo, Long tenantNo, Long accountNo, double maxSimilarity, List pictures, List historyLists) { try { + // 去重 + List hisPictureRepeats = historyLists.stream() + .collect(Collectors.collectingAndThen( + Collectors.toMap( + TaskCompletionRequest.HisPictureRepeat::getHisTaskNo, // 按 hisTaskNo 作为 key + hisPictureRepeat -> hisPictureRepeat, // 保留整个对象 + (existing, replacement) -> existing), // 保留第一个出现的元素 + map -> new ArrayList<>(map.values()) + )); // 构造任务完成数据 TaskCompletionRequest.TaskCompletionData data = new TaskCompletionRequest.TaskCompletionData(); data.setTenantNo(tenantNo); @@ -243,7 +252,7 @@ public class DuplicateTaskRunner { repeat.setImgName(p.getImgName()); repeat.setImgUrl(p.getImageUrl()); repeat.setDynamicFields(new HashMap<>()); // 动态字段待补充 - repeat.setHisPictureRepeatList(historyLists); + repeat.setHisPictureRepeatList(hisPictureRepeats); return repeat; }) .collect(Collectors.toList());