From f671ec40e959072f46adeea9d0a5519a2d82b1b2 Mon Sep 17 00:00:00 2001 From: Yann <1319542051@qq.com> Date: Mon, 24 Nov 2025 09:29:53 +0800 Subject: [PATCH 1/6] =?UTF-8?q?update=20configuration=E4=B8=ADprefix?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fs/framework/preview/office/JodConverterConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java index 9b1155bc..49be786b 100644 --- a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java +++ b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java @@ -14,7 +14,7 @@ import java.io.File; @Slf4j @Configuration @RequiredArgsConstructor -@ConditionalOnProperty(prefix = "file.preview.office", name = "enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(prefix = "fs.preview.office", name = "enabled", havingValue = "true", matchIfMissing = true) public class JodConverterConfiguration { private final OfficeToPdfConfig config; -- Gitee From fafdef3aebfff679b6f3e582bb81f275f24ecf76 Mon Sep 17 00:00:00 2001 From: Yann <1319542051@qq.com> Date: Mon, 24 Nov 2025 15:43:14 +0800 Subject: [PATCH 2/6] =?UTF-8?q?update=20=E5=BC=80=E5=85=B3=E6=8E=A7?= =?UTF-8?q?=E5=88=B6office=E6=8F=92=E4=BB=B6=E9=A2=84=E8=A7=88=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=B1=BB=E6=B3=A8=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/converter/impl/OfficeToPdfConverter.java | 2 -- .../preview/office/JodConverterConfiguration.java | 12 ++++++++++++ .../preview/strategy/impl/OfficePreviewStrategy.java | 2 -- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/converter/impl/OfficeToPdfConverter.java b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/converter/impl/OfficeToPdfConverter.java index 330dc63b..32b3d5f6 100644 --- a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/converter/impl/OfficeToPdfConverter.java +++ b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/converter/impl/OfficeToPdfConverter.java @@ -8,7 +8,6 @@ import org.jodconverter.core.DocumentConverter; import org.jodconverter.core.office.OfficeException; import org.jodconverter.core.office.OfficeManager; import org.jodconverter.local.LocalConverter; -import org.springframework.stereotype.Component; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -19,7 +18,6 @@ import java.nio.file.Path; import java.util.UUID; @Slf4j -@Component @RequiredArgsConstructor public class OfficeToPdfConverter implements IConverter { diff --git a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java index 49be786b..7ffbe548 100644 --- a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java +++ b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/office/JodConverterConfiguration.java @@ -1,5 +1,7 @@ package com.xddcodec.fs.framework.preview.office; +import com.xddcodec.fs.framework.preview.converter.impl.OfficeToPdfConverter; +import com.xddcodec.fs.framework.preview.strategy.impl.OfficePreviewStrategy; import jakarta.annotation.PreDestroy; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -51,6 +53,16 @@ public class JodConverterConfiguration { return officeManager; } + @Bean + public OfficeToPdfConverter officeToPdfConverter(OfficeManager officeManager, OfficeToPdfConfig config) { + return new OfficeToPdfConverter(officeManager, config); + } + + @Bean + public OfficePreviewStrategy officePreviewStrategy(OfficeToPdfConverter officeToPdfConverter) { + return new OfficePreviewStrategy(officeToPdfConverter); + } + /** * 确保项目关闭时,LibreOffice 也能关闭 */ diff --git a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/strategy/impl/OfficePreviewStrategy.java b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/strategy/impl/OfficePreviewStrategy.java index c4b94240..61a19059 100644 --- a/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/strategy/impl/OfficePreviewStrategy.java +++ b/fs-framework/fs-preview/src/main/java/com/xddcodec/fs/framework/preview/strategy/impl/OfficePreviewStrategy.java @@ -8,11 +8,9 @@ import com.xddcodec.fs.framework.preview.core.PreviewContext; import com.xddcodec.fs.framework.preview.strategy.AbstractPreviewStrategy; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; import org.springframework.ui.Model; @Slf4j -@Component @RequiredArgsConstructor public class OfficePreviewStrategy extends AbstractPreviewStrategy { -- Gitee From 82a61376be082bfaa50fb6936900db71c2b2ff50 Mon Sep 17 00:00:00 2001 From: Yann <1319542051@qq.com> Date: Mon, 24 Nov 2025 17:48:11 +0800 Subject: [PATCH 3/6] =?UTF-8?q?update=20=E4=BC=A0=E8=BE=93vo=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xddcodec/fs/file/domain/vo/FileTransferTaskVO.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/domain/vo/FileTransferTaskVO.java b/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/domain/vo/FileTransferTaskVO.java index 69af7efa..7ff69dec 100644 --- a/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/domain/vo/FileTransferTaskVO.java +++ b/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/domain/vo/FileTransferTaskVO.java @@ -3,6 +3,7 @@ package com.xddcodec.fs.file.domain.vo; import com.fasterxml.jackson.annotation.JsonFormat; import com.xddcodec.fs.file.domain.FileTransferTask; import com.xddcodec.fs.file.enums.TransferTaskStatus; +import com.xddcodec.fs.file.enums.TransferTaskType; import com.xddcodec.fs.framework.common.utils.DateUtils; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; @@ -22,6 +23,10 @@ public class FileTransferTaskVO implements Serializable { * 任务ID */ private String taskId; + /** + * 任务类型 + */ + private TransferTaskType taskType; /** * 用户ID */ -- Gitee From 70118c2c7a9ec5c3ccfc26cc3684098d1b1dabf3 Mon Sep 17 00:00:00 2001 From: Yann <1319542051@qq.com> Date: Tue, 25 Nov 2025 09:36:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?update=20=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/preview/unsupported.html | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/fs-framework/fs-preview/src/main/resources/templates/preview/unsupported.html b/fs-framework/fs-preview/src/main/resources/templates/preview/unsupported.html index e69de29b..cb3724dd 100644 --- a/fs-framework/fs-preview/src/main/resources/templates/preview/unsupported.html +++ b/fs-framework/fs-preview/src/main/resources/templates/preview/unsupported.html @@ -0,0 +1,161 @@ + + + + + + 文件无法预览 + + + +
+
+ + + +
+ +

+ +

+ 文件 无法在线打开。
+ 您可以下载文件到本地进行查看。 +

+ +
+ +
+
+ + + + \ No newline at end of file -- Gitee From 09f3979edc7168a0424f574de3e7aa4690d73dbf Mon Sep 17 00:00:00 2001 From: dinghao <459102951@qq.com> Date: Tue, 25 Nov 2025 21:39:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86bug?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1=E7=AB=AF=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E5=BC=8F=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/CommonConstant.java | 2 +- .../mail/service/NoOpJavaMailSender.java | 60 +++++++++++++++++-- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/fs-framework/fs-common-core/src/main/java/com/xddcodec/fs/framework/common/constant/CommonConstant.java b/fs-framework/fs-common-core/src/main/java/com/xddcodec/fs/framework/common/constant/CommonConstant.java index 4e26bc6d..f94c7909 100644 --- a/fs-framework/fs-common-core/src/main/java/com/xddcodec/fs/framework/common/constant/CommonConstant.java +++ b/fs-framework/fs-common-core/src/main/java/com/xddcodec/fs/framework/common/constant/CommonConstant.java @@ -42,5 +42,5 @@ public interface CommonConstant { /** * 验证码长度 */ - Integer VERIFY_CODE_LENGTH = 4; + Integer VERIFY_CODE_LENGTH = 6; } diff --git a/fs-framework/fs-notify/src/main/java/com/xddcodec/fs/framework/notify/mail/service/NoOpJavaMailSender.java b/fs-framework/fs-notify/src/main/java/com/xddcodec/fs/framework/notify/mail/service/NoOpJavaMailSender.java index 2461ac56..35ffdccd 100644 --- a/fs-framework/fs-notify/src/main/java/com/xddcodec/fs/framework/notify/mail/service/NoOpJavaMailSender.java +++ b/fs-framework/fs-notify/src/main/java/com/xddcodec/fs/framework/notify/mail/service/NoOpJavaMailSender.java @@ -1,37 +1,85 @@ package com.xddcodec.fs.framework.notify.mail.service; - +import jakarta.mail.Session; import jakarta.mail.internet.MimeMessage; +import lombok.extern.slf4j.Slf4j; import org.springframework.mail.MailException; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessagePreparator; import java.io.InputStream; +import java.util.Properties; /** - * - * @author Yann - * @date 2025/11/20 11:31 + * 空邮件发送器 - 用于禁用邮件功能时拦截邮件发送 */ +@Slf4j public class NoOpJavaMailSender implements JavaMailSender { + private static final Session DUMMY_SESSION = Session.getInstance(new Properties()); + @Override public MimeMessage createMimeMessage() { - return null; + return new MimeMessage(DUMMY_SESSION); } @Override public MimeMessage createMimeMessage(InputStream contentStream) throws MailException { - return null; + try { + return new MimeMessage(DUMMY_SESSION, contentStream); + } catch (Exception e) { + log.warn("创建 MimeMessage 失败(空邮件发送器)", e); + return new MimeMessage(DUMMY_SESSION); + } + } + + @Override + public void send(MimeMessage mimeMessage) throws MailException { + log.info("[空邮件发送器] 拦截邮件发送(MimeMessage)"); + logMailInfo(mimeMessage); } @Override public void send(MimeMessage... mimeMessages) throws MailException { + log.info("[空邮件发送器] 拦截批量邮件发送,数量: {}", mimeMessages.length); + for (MimeMessage msg : mimeMessages) { + logMailInfo(msg); + } + } + + @Override + public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException { + log.info("[空邮件发送器] 拦截邮件发送(MimeMessagePreparator)"); + } + @Override + public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException { + log.info("[空邮件发送器] 拦截批量邮件发送,数量: {}", mimeMessagePreparators.length); + } + + @Override + public void send(SimpleMailMessage simpleMessage) throws MailException { + log.info("[空邮件发送器] 拦截简单邮件发送: 收件人={}, 主题={}", + simpleMessage.getTo(), simpleMessage.getSubject()); } @Override public void send(SimpleMailMessage... simpleMessages) throws MailException { + log.info("[空邮件发送器] 拦截批量简单邮件发送,数量: {}", simpleMessages.length); + } + /** + * 记录邮件信息(方便调试) + */ + private void logMailInfo(MimeMessage message) { + try { + log.info(" → 收件人: {}", message.getAllRecipients() != null ? + String.join(", ", java.util.Arrays.stream(message.getAllRecipients()) + .map(Object::toString).toArray(String[]::new)) : "无"); + log.info(" → 主题: {}", message.getSubject()); + } catch (Exception e) { + log.debug("解析邮件信息失败", e); + } } } -- Gitee From 099c2be172ed066bb9c39bb6ad24ab606cdd9c44 Mon Sep 17 00:00:00 2001 From: Freedom <459102951@qq.com> Date: Tue, 9 Dec 2025 09:05:42 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=89=E7=A7=92?= =?UTF-8?q?=E4=BC=A0=E6=96=87=E4=BB=B6=E5=AD=98=E5=9C=A8=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=BA=94=E7=89=A9=E7=90=86=E5=88=A0=E9=99=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FileInfoServiceImpl.java | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/service/impl/FileInfoServiceImpl.java b/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/service/impl/FileInfoServiceImpl.java index 1994daec..3d642498 100644 --- a/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/service/impl/FileInfoServiceImpl.java +++ b/fs-modules/fs-file/src/main/java/com/xddcodec/fs/file/service/impl/FileInfoServiceImpl.java @@ -30,6 +30,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionSynchronization; +import org.springframework.transaction.support.TransactionSynchronizationManager; import java.io.InputStream; import java.time.LocalDateTime; @@ -443,31 +445,43 @@ public class FileInfoServiceImpl extends ServiceImpl i if (CollUtil.isEmpty(fileIds)) { return; } - String userId = StpUtil.getLoginIdAsString(); - Set allFileIds = collectFileIdsRecursively( fileIds, userId, wrapper -> wrapper.and(FILE_INFO.IS_DELETED.eq(true)) // 只能删除回收站中的 ); - if (CollUtil.isEmpty(allFileIds)) { throw new BusinessException("未找到要删除的文件或文件夹"); } + List physicalFilesToDelete = new ArrayList<>(); + for (String allFileId : allFileIds) { + FileInfo fileInfo = getById(allFileId); + String objectKey = fileInfo.getObjectKey(); - // 查询所有文件信息(用于删除物理文件) - List allFiles = listByIds(allFileIds); + long count = this.count(new QueryWrapper() + .where(FILE_INFO.OBJECT_KEY.eq(objectKey) + .and(FILE_INFO.ID.ne(allFileId)))); // 排除当前要删除的 - // 批量删除物理文件 - allFiles.stream() - .filter(file -> !file.getIsDir()) - .forEach(this::deletePhysicalFile); - - // 批量删除数据库记录 + if (count == 0) { + physicalFilesToDelete.add(fileInfo); + } + } removeByIds(allFileIds); - - log.info("用户 {} 永久删除文件/文件夹,共 {} 项", userId, allFileIds.size()); + TransactionSynchronizationManager.registerSynchronization( + new TransactionSynchronization() { + @Override + public void afterCommit() { + for (FileInfo file : physicalFilesToDelete) { + try { + deletePhysicalFile(file); + } catch (Exception e) { + log.error("删除物理文件失败: {}", file.getObjectKey(), e); + } + } + } + } + ); } @Transactional(rollbackFor = Exception.class) -- Gitee