|
|
|
|
@@ -57,13 +57,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
|
import org.assertj.core.util.DateUtil;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.mock.web.MockMultipartFile;
|
|
|
|
|
@@ -644,7 +642,20 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
setAnalysisDirectionName(files);
|
|
|
|
|
setSimulationPoolAndTaskInfo(files);
|
|
|
|
|
PageInfo<FileMetadataInfo> page = new PageInfo<>(files);
|
|
|
|
|
return PageUtils.getJsonObjectSdmResponse(files, page);
|
|
|
|
|
|
|
|
|
|
long total = page.getTotal();
|
|
|
|
|
List<FileMetadataInfoResp> dtoList = files.stream().map(entity -> {
|
|
|
|
|
FileMetadataInfoResp dto = new FileMetadataInfoResp();
|
|
|
|
|
BeanUtils.copyProperties(entity, dto);
|
|
|
|
|
|
|
|
|
|
//计算当前用户对该文件的综合权限位
|
|
|
|
|
// 对于列表查询,如果层级很深,频繁递归会有性能问题。
|
|
|
|
|
dto.setPermissionValue(fileUserPermissionService.getMergedPermission(entity.getId(), ThreadLocalContext.getUserId()));
|
|
|
|
|
return dto;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
PageInfo<FileMetadataInfoResp> page1 = new PageInfo<>(dtoList);
|
|
|
|
|
page1.setTotal(total);
|
|
|
|
|
return PageUtils.getJsonObjectSdmResponse(dtoList, page1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -661,6 +672,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
FileMetadataInfoResp fileMetadataInfoResp = new FileMetadataInfoResp();
|
|
|
|
|
BeanUtils.copyProperties(fileMetadataInfo, fileMetadataInfoResp);
|
|
|
|
|
|
|
|
|
|
fileMetadataInfoResp.setPermissionValue(fileUserPermissionService.getMergedPermission(fileMetadataInfo.getId(), ThreadLocalContext.getUserId()));
|
|
|
|
|
|
|
|
|
|
return SdmResponse.success(fileMetadataInfoResp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -707,6 +720,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
List<FileMetadataInfoResp> dtoList = list.stream().map(entity -> {
|
|
|
|
|
FileMetadataInfoResp dto = new FileMetadataInfoResp();
|
|
|
|
|
BeanUtils.copyProperties(entity, dto);
|
|
|
|
|
|
|
|
|
|
//计算当前用户对该文件的综合权限位
|
|
|
|
|
// 对于列表查询,如果层级很深,频繁递归会有性能问题。
|
|
|
|
|
dto.setPermissionValue(fileUserPermissionService.getMergedPermission(entity.getId(), ThreadLocalContext.getUserId()));
|
|
|
|
|
return dto;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
PageInfo<FileMetadataInfoResp> page1 = new PageInfo<>(dtoList);
|
|
|
|
|
@@ -784,7 +801,12 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
newObjectKey = oldObjectKey.substring(0, oldObjectKey.lastIndexOf("/") + 1) + newName;
|
|
|
|
|
|
|
|
|
|
minioService.renameFile(oldObjectKey, newObjectKey,bucketName);
|
|
|
|
|
fileMetadataInfoService.lambdaUpdate().set(FileMetadataInfo::getObjectKey, newObjectKey).set(FileMetadataInfo::getOriginalName, newName).eq(FileMetadataInfo::getId, fileId).update();
|
|
|
|
|
fileMetadataInfoService.lambdaUpdate()
|
|
|
|
|
.set(FileMetadataInfo::getObjectKey, newObjectKey)
|
|
|
|
|
.set(FileMetadataInfo::getOriginalName, newName)
|
|
|
|
|
.set(FileMetadataInfo::getUpdateTime, new Date())
|
|
|
|
|
.set(FileMetadataInfo::getUpdaterId, ThreadLocalContext.getUserId())
|
|
|
|
|
.eq(FileMetadataInfo::getId, fileId).update();
|
|
|
|
|
return SdmResponse.success("重命名成功");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("重命名文件失败", e);
|
|
|
|
|
@@ -944,7 +966,12 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
minioService.renameFile(oldDirMinioObjectKey, newDirMinioObjectKey,dirMetadataInfo.getBucketName());
|
|
|
|
|
fileMetadataInfoService.lambdaUpdate().set(FileMetadataInfo::getObjectKey, newDirMinioObjectKey).set(FileMetadataInfo::getOriginalName, req.getNewName()).eq(FileMetadataInfo::getId, dirMetadataInfo.getId()).update();
|
|
|
|
|
fileMetadataInfoService.lambdaUpdate()
|
|
|
|
|
.set(FileMetadataInfo::getObjectKey, newDirMinioObjectKey)
|
|
|
|
|
.set(FileMetadataInfo::getOriginalName, req.getNewName())
|
|
|
|
|
.set(FileMetadataInfo::getUpdateTime, new Date())
|
|
|
|
|
.set(FileMetadataInfo::getUpdaterId, ThreadLocalContext.getUserId())
|
|
|
|
|
.eq(FileMetadataInfo::getId, dirMetadataInfo.getId()).update();
|
|
|
|
|
return SdmResponse.success("重命名目录成功");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("重命名目录失败", e);
|
|
|
|
|
@@ -1522,13 +1549,14 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
fileMetadataInfoLambdaQueryChainWrapper.eq(FileMetadataInfo::getParentId, parentDirId);
|
|
|
|
|
}
|
|
|
|
|
List<FileMetadataInfo> list = fileMetadataInfoLambdaQueryChainWrapper.eq(FileMetadataInfo::getTenantId, ThreadLocalContext.getTenantId()).eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue()).orderByDesc(FileMetadataInfo::getCreateTime).list();
|
|
|
|
|
setCreatorNames(list);
|
|
|
|
|
|
|
|
|
|
List<FileMetadataInfoResp> dtoList = list.stream().map(entity -> {
|
|
|
|
|
FileMetadataInfoResp dto = new FileMetadataInfoResp();
|
|
|
|
|
BeanUtils.copyProperties(entity, dto);
|
|
|
|
|
|
|
|
|
|
// todo 后面接入用户系统设置
|
|
|
|
|
dto.setCreatorName("");
|
|
|
|
|
//计算当前用户对该文件的综合权限位
|
|
|
|
|
// 对于列表查询,如果层级很深,频繁递归会有性能问题。
|
|
|
|
|
dto.setPermissionValue(fileUserPermissionService.getMergedPermission(entity.getId(), ThreadLocalContext.getUserId()));
|
|
|
|
|
return dto;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
@@ -1577,10 +1605,11 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
tempFileMetadataInfo.setRemarks(req.getRemarks());
|
|
|
|
|
tempFileMetadataInfo.setSimulationPoolInfoList(req.getSimulationPoolInfoList());
|
|
|
|
|
tempFileMetadataInfo.setCreateTime(fileMetadataInfo.getCreateTime());
|
|
|
|
|
tempFileMetadataInfo.setUpdateTime(fileMetadataInfo.getCreateTime());
|
|
|
|
|
tempFileMetadataInfo.setUpdaterId(ThreadLocalContext.getUserId());
|
|
|
|
|
tempFileMetadataInfo.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
fileMetadataInfo.setTempMetadata(JSONObject.toJSONString(tempFileMetadataInfo));
|
|
|
|
|
fileMetadataInfo.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
fileMetadataInfo.setUpdaterId(ThreadLocalContext.getUserId());
|
|
|
|
|
|
|
|
|
|
//发起审批
|
|
|
|
|
FileApproveRequestBuilder updateFileMetaIntoApproveRequestBuilder = FileApproveRequestBuilder.builder()
|
|
|
|
|
@@ -1615,6 +1644,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
fileMetadataInfo.setProjectId(req.getProjectId());
|
|
|
|
|
fileMetadataInfo.setAnalysisDirectionId(req.getAnalysisDirectionId());
|
|
|
|
|
fileMetadataInfo.setRemarks(req.getRemarks());
|
|
|
|
|
fileMetadataInfo.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
fileMetadataInfo.setUpdaterId(ThreadLocalContext.getUserId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fileMetadataInfoService.updateById(fileMetadataInfo);
|
|
|
|
|
@@ -2172,12 +2203,20 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
try {
|
|
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
// 提取去重的 creatorId
|
|
|
|
|
List<Long> creatorIds = list.stream()
|
|
|
|
|
List<Long> creatorIds = new ArrayList<>(list.stream()
|
|
|
|
|
.map(FileMetadataInfo::getCreatorId)
|
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
|
.distinct()
|
|
|
|
|
.toList());
|
|
|
|
|
|
|
|
|
|
List<Long> updaterIds = list.stream()
|
|
|
|
|
.map(FileMetadataInfo::getUpdaterId)
|
|
|
|
|
.filter(Objects::nonNull)
|
|
|
|
|
.distinct()
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
creatorIds.addAll(updaterIds);
|
|
|
|
|
|
|
|
|
|
// 远程查询用户信息
|
|
|
|
|
SdmResponse<List<CIDUserResp>> userListSdmRsp = sysUserFeignClient.listUserByIds(
|
|
|
|
|
UserQueryReq.builder().userIds(creatorIds).build()
|
|
|
|
|
@@ -2194,6 +2233,15 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
cidUser.getRealName()
|
|
|
|
|
);
|
|
|
|
|
fileMetadataInfo.setCreatorName(username);
|
|
|
|
|
|
|
|
|
|
Long updaterId = fileMetadataInfo.getUpdaterId();
|
|
|
|
|
CIDUserResp cidUser1 = cidUserMap.get(updaterId);
|
|
|
|
|
String username1 = Objects.isNull(cidUser1) ? "" : org.apache.commons.lang3.StringUtils.firstNonBlank(
|
|
|
|
|
cidUser1.getNickname(),
|
|
|
|
|
cidUser1.getUsername(),
|
|
|
|
|
cidUser1.getRealName()
|
|
|
|
|
);
|
|
|
|
|
fileMetadataInfo.setUpdaterName(username1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|