From dc3336685e80c593a3654a6e53e3e1d1d13b2b50 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 06 五月 2026 15:30:13 +0800
Subject: [PATCH] fix(approve): 修复流程配置节点审批人为空时的异常处理
---
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java | 71 +++++++++++++++++++++++++++++------
1 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
index 9f452ac..29013d3 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -3,19 +3,20 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.dto.CustomerFollowUpFileDto;
import com.ruoyi.basic.mapper.CustomerFollowUpMapper;
import com.ruoyi.basic.pojo.CustomerFollowUp;
import com.ruoyi.basic.pojo.CustomerFollowUpFile;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.ICustomerService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
-
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -28,7 +29,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.UUID;
@@ -42,13 +43,15 @@
* @since 2026/03/04 14:48
*/
@Service
+@RequiredArgsConstructor
public class CustomerFollowUpServiceImpl extends ServiceImpl<CustomerFollowUpMapper, CustomerFollowUp> implements CustomerFollowUpService {
- @Autowired
- private CustomerFollowUpFileService customerFollowUpFileService;
+ private final CustomerFollowUpFileService customerFollowUpFileService;
@Value("${file.upload-dir}")
private String uploadDir;
+
+ private final ISysUserService sysUserService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -78,8 +81,8 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public void addFollowUpFiles(List<MultipartFile> files, Integer followUpId) {
- handleFollowUpFiles(files, followUpId);
+ public List<CustomerFollowUpFileDto> addFollowUpFiles(List<MultipartFile> files, Integer followUpId) {
+ return handleFollowUpFiles(files, followUpId);
}
@Override
@@ -127,7 +130,7 @@
}
List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
- .eq(CustomerFollowUp::getCustomerId, customerId));
+ .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId));
if (followUps != null && !followUps.isEmpty()) {
for (CustomerFollowUp followUp : followUps) {
@@ -136,14 +139,27 @@
}
}
- private void handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) {
+ @Override
+ public 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 customerFollowUpFileService.list(queryWrapper);
+ }
+
+ private List<CustomerFollowUpFileDto> handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) {
+ List<CustomerFollowUpFile> fileList = new ArrayList<>();
+ List<CustomerFollowUpFileDto> dtoList = new ArrayList<>();
if (multipartFiles == null || multipartFiles.isEmpty()) {
- return;
+ return dtoList;
}
Long currentUserId = SecurityUtils.getUserId();
Long currentTenantId = SecurityUtils.getLoginUser().getTenantId();
- List<CustomerFollowUpFile> fileList = new ArrayList<>();
for (MultipartFile file : multipartFiles) {
if (file == null || file.isEmpty()) {
@@ -159,7 +175,8 @@
String originalFilename = file.getOriginalFilename();
String fileExtension = FilenameUtils.getExtension(originalFilename);
- String formalFilename = followUpId + "_" +
+ String prefix = (followUpId != null) ? followUpId.toString() : "temp";
+ String formalFilename = prefix + "_" +
System.currentTimeMillis() + "_" +
UUID.randomUUID().toString().substring(0, 8) +
(StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
@@ -184,7 +201,35 @@
}
if (!fileList.isEmpty()) {
customerFollowUpFileService.saveBatch(fileList);
+ return convertToDtoList(fileList);
}
+ return dtoList;
+ }
+
+ private List<CustomerFollowUpFileDto> convertToDtoList(List<CustomerFollowUpFile> fileList) {
+ List<CustomerFollowUpFileDto> dtoList = new ArrayList<>();
+ if (fileList == null || fileList.isEmpty()) {
+ return dtoList;
+ }
+ for (CustomerFollowUpFile entity : fileList) {
+ CustomerFollowUpFileDto dto = new CustomerFollowUpFileDto();
+ BeanUtils.copyProperties(entity, dto);
+
+ if (entity.getCreateUser() != null) {
+ SysUser createUser = sysUserService.selectUserById(entity.getCreateUser());
+ if (createUser != null) {
+ dto.setCreateUserName(createUser.getNickName());
+ }
+ }
+ if (entity.getUpdateUser() != null) {
+ SysUser updateUser = sysUserService.selectUserById(entity.getUpdateUser());
+ if (updateUser != null) {
+ dto.setUpdateUserName(updateUser.getNickName());
+ }
+ }
+ dtoList.add(dto);
+ }
+ return dtoList;
}
private void validateFollowUp(CustomerFollowUp followUp) {
--
Gitblit v1.9.3