From dd69bfc1fb8e5e28dde754fab7f23bfb1a18faa5 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 05 六月 2026 16:58:07 +0800
Subject: [PATCH] config(dev): 更新开发环境配置和文件上传功能 - 调整文件上传路径配置 - 修复OA环境文件链接前缀配置 - 在审批实例服务中添加报销相关数据删除逻辑 - 实现申请人姓名自动填充功能 - 添加文件下载预览路由的正则表达式支持 - 为企业新闻VO添加附件列表兼容别名 - 完善员工入职服务的异常处理 - 新增账户附件管理控制器 - 实现文件上传接口并返回完整文件信息
---
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java | 63 +++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
index 48cbddb..cb915c4 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
@@ -1,10 +1,21 @@
package com.ruoyi.basic.service.impl;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
import com.ruoyi.basic.mapper.CustomerFollowUpFileMapper;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
+import com.ruoyi.common.vo.SimpleFileVo;
+import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
/**
* <br>
@@ -16,5 +27,57 @@
* @since 2026/03/04 14:53
*/
@Service
+@RequiredArgsConstructor
public class CustomerFollowUpFileServiceImpl extends ServiceImpl<CustomerFollowUpFileMapper, CustomerFollowUpFile> implements CustomerFollowUpFileService {
+
+ private final CustomerFollowUpFileMapper customerFollowUpFileMapper;
+
+ @Override
+ public <T> void fillAttachment(List<T> list, Function<T, String> getAttachmentIds, BiConsumer<T, List<SimpleFileVo>> setAttachmentList) {
+ if (CollUtil.isEmpty(list)) {
+ return;
+ }
+ // 鏀堕泦鎵�鏈夋枃浠禝D
+ Set<Long> ids = list.stream()
+ .map(getAttachmentIds)
+ .filter(StrUtil::isNotBlank)
+ .flatMap(s -> Arrays.stream(s.split(",")))
+ .map(Long::valueOf)
+ .collect(Collectors.toSet());
+ List<CustomerFollowUpFile> followUpFilesByIds = new ArrayList<>();
+ Lists.partition(Lists.newArrayList(ids), 999).forEach(it -> {
+ followUpFilesByIds.addAll(
+ getFollowUpFilesByIds(it)
+ );
+ });
+ if (CollUtil.isEmpty(followUpFilesByIds)) {
+ return;
+ }
+ Map<Long, SimpleFileVo> collectMap = followUpFilesByIds.stream().map(SimpleFileVo::convert).collect(Collectors.toMap(
+ SimpleFileVo::getId,
+ Function.identity()
+ ));
+ list.forEach(t -> {
+ String attachmentIds = getAttachmentIds.apply(t);
+ if (StrUtil.isNotBlank(attachmentIds)) {
+ List<SimpleFileVo> fileVos = Arrays.stream(attachmentIds.split(","))
+ .map(Long::valueOf)
+ .map(it->collectMap.getOrDefault(it, null))
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ setAttachmentList.accept(t, fileVos);
+ }
+ });
+ }
+
+ private List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds) {
+ if (fileIds == null || fileIds.isEmpty()) {
+ return new ArrayList<>(0);
+ }
+
+ LambdaQueryWrapper<CustomerFollowUpFile> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(CustomerFollowUpFile::getId, fileIds)
+ .select(CustomerFollowUpFile::getId, CustomerFollowUpFile::getFileUrl, CustomerFollowUpFile::getFileName);
+ return customerFollowUpFileMapper.selectList(queryWrapper);
+ }
}
--
Gitblit v1.9.3