feat(REQ-3004) - 代运营处理租户的问题

This commit is contained in:
wangli 2024-11-26 17:35:57 +08:00
parent bb0fb418b3
commit 421898131d

View File

@ -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<FormVO> pageForm(BpmnFormRelationSearchDTO searchDTO) {
List<ExtAxBpmnFormRelation> list = bpmnFormRelationService.keyQuery(searchDTO);
Set<String> uniqueKeys = new HashSet<>();
List<ExtAxBpmnFormRelation> uniqueRecords = list.stream()
.filter(record -> uniqueKeys.add(record.getKey() + record.getTenantId()))
.collect(Collectors.toList());
List<String> keys = list.stream().map(ExtAxBpmnFormRelation::getKey).distinct().collect(Collectors.toList());
Map<String, CategoryItemVO> 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())