public Map<String, List<AttachmentVo>> getCardAttachmentMap(List<Card> cards) {
        Set<String> businessIds = cards.stream()
                .filter(item -> BooleanUtils.isTrue(item.getHasAttachment()))
                .map(Card::getId).collect(Collectors.toSet());
        List<Attachment> attachments = attachmentRepository.findByBusinessIdIn(businessIds);
        if (CollectionUtils.isEmpty(attachments)) {
            return Collections.emptyMap();
        }
        return attachments.stream()
                .map(item -> BeanExtUtils.convert(item, AttachmentVo::new)
                        .setSize(FileUtils.byteCountToDisplaySize(item.getSize())))
                .collect(Collectors.groupingBy(AttachmentVo::getBusinessId));
    }
getCardAttachmentMap

@param cards cards
@return Map
src/main/java/com/tuituidan/openhub/service/AttachmentService.java