From 421898131d90d60dc9b2d8ea143e5cb72f00b12a Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Tue, 26 Nov 2024 17:35:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(REQ-3004)=20-=20=E4=BB=A3=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E5=A4=84=E7=90=86=E7=A7=9F=E6=88=B7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/service/impl/FormCoreServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/FormCoreServiceImpl.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/FormCoreServiceImpl.java index 7abfb0cc5..557885d13 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/FormCoreServiceImpl.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/FormCoreServiceImpl.java @@ -38,8 +38,10 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -79,11 +81,14 @@ public class FormCoreServiceImpl implements FormCoreService { @Override public List pageForm(BpmnFormRelationSearchDTO searchDTO) { List list = bpmnFormRelationService.keyQuery(searchDTO); + + Set uniqueKeys = new HashSet<>(); + List uniqueRecords = list.stream() + .filter(record -> uniqueKeys.add(record.getKey() + record.getTenantId())) + .collect(Collectors.toList()); List keys = list.stream().map(ExtAxBpmnFormRelation::getKey).distinct().collect(Collectors.toList()); Map categoryMap = categoryService.listByValue(BPM_MODEL_CATEGORY, keys).stream().collect(Collectors.toMap(CategoryItemVO::getValue, Function.identity(), (s, t) -> s)); - return list.stream() - .collect(Collectors.collectingAndThen(Collectors.toMap(ExtAxBpmnFormRelation::getKey, Function.identity(), (s, t) -> s), x -> new ArrayList<>(x.values()))) - .stream() + return uniqueRecords.stream() .map(e -> FormVO.builder() .key(e.getKey()) .name(categoryMap.getOrDefault(e.getKey(), new CategoryItemVO()).getLabel())