feat(projectFile): 增加文件物理删除功能

- 在 ProjectFileMapper 中添加 file_path 字段的查询
- 在 ProjectFileServiceImpl 中实现文件物理删除逻辑
- 使用 FileUtils.deleteFile 方法删除文件,备用方案使用 Files.delete 方法
- 移除 TaskServiceImpl 中的 todo 注释
dev_1.2.1
chenhao 2025-04-28 16:30:01 +08:00
parent 262218c161
commit 9e0b7b3b7f
3 changed files with 8 additions and 2 deletions

View File

@ -197,7 +197,6 @@ public class TaskServiceImpl implements TaskService {
examineTask.setTaskStatus(0);
}
}
//todo 排序有问题
return examineTasks.stream().collect(Collectors.groupingBy(ExamineTask::getTaskStatus));
}

View File

@ -10,6 +10,10 @@ import tech.unissense.pms.common.config.RuoYiConfig;
import tech.unissense.pms.common.utils.file.FileUtils;
import javax.annotation.Resource;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -63,6 +67,8 @@ public class ProjectFileServiceImpl implements IProjectFileService {
ProjectFile projectFile = projectFileMapper.queryById(id);
try {
FileUtils.deleteFile(RuoYiConfig.getProfile()+projectFile.getFilePath());
// Path path = Paths.get(RuoYiConfig.getProfile() + projectFile.getFilePath());
// Files.delete(path);
} catch (Exception e) {
log.error("删除文件失败,失败详情:{}", e.getStackTrace());
}

View File

@ -87,7 +87,8 @@
create_by,
update_by,
update_time,
create_time
create_time,
file_path
FROM pms_project_file
WHERE id = #{id}
LIMIT 1