fix:任务执行人对算例、关联需求文件夹的权限
This commit is contained in:
@@ -1406,12 +1406,22 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
String oldDirMinioObjectKey = sourceMetadataInfo.getObjectKey();
|
||||
// 要挪到的task文件夹
|
||||
FileMetadataInfo targetParentMetadataInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getRelatedResourceUuid, req.getParentUuid()).one();
|
||||
String originalName = sourceMetadataInfo.getOriginalName();
|
||||
|
||||
// 如果文件有后缀,则在文件名和后缀之间插入版本号
|
||||
int dotIndex = originalName.lastIndexOf('.');
|
||||
// 新的路径名
|
||||
String newDirMinioObjectKey = getFileMinioObjectKey(targetParentMetadataInfo.getObjectKey() + sourceMetadataInfo.getOriginalName());
|
||||
String newDirMinioObjectKey = getFileMinioObjectKey(targetParentMetadataInfo.getObjectKey() + originalName.substring(0, dotIndex) + "_V1" + originalName.substring(dotIndex));
|
||||
|
||||
// 把以前归档的过同名文件删除 保留最新的
|
||||
Optional<FileMetadataInfo> existingFileOptional = getFileMetadataInfoByObjectKey(newDirMinioObjectKey, ThreadLocalContext.getTenantId());
|
||||
existingFileOptional.ifPresent(existingFile -> fileMetadataInfoService.removeById(existingFile));
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
String currentTenantBucketName = minioService.getCurrentTenantBucketName();
|
||||
FileMetadataInfo existFile = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getBucketName, currentTenantBucketName)
|
||||
.eq(FileMetadataInfo::getObjectKey, newDirMinioObjectKey)
|
||||
.eq(ObjectUtils.isNotEmpty(tenantId), FileMetadataInfo::getTenantId, tenantId).one();
|
||||
if (existFile != null) {
|
||||
fileMetadataInfoService.removeById(existFile);
|
||||
}
|
||||
|
||||
try {
|
||||
minioService.copyFile(oldDirMinioObjectKey, newDirMinioObjectKey,sourceMetadataInfo.getBucketName());
|
||||
|
||||
Reference in New Issue
Block a user