|
|
|
|
@@ -312,7 +312,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
if (dirMetadataInfo == null) {
|
|
|
|
|
return SdmResponse.failed("目录不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(req.getSourceFiles())) {
|
|
|
|
|
List<BatchAddFileInfoResp> addFileInfoRespList = new ArrayList<>();
|
|
|
|
|
for (UploadFilesReq fileReq : req.getSourceFiles()) {
|
|
|
|
|
@@ -342,7 +342,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
try {
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(fileMinioObjectKey, fileReq.getFileName(), fileReq.getFileType(),
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), dirMetadataInfo.getId(), fileReq.getSize());
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), dirMetadataInfo.getId(), fileReq.getSize()
|
|
|
|
|
,req.getSimulationPoolId(),req.getSimulationPoolVersion(),req.getSimulationPoolTaskIds());
|
|
|
|
|
fileInfo.setUploadTaskId(req.getUploadTaskId());
|
|
|
|
|
fileInfo.setTemplateId(req.getTemplateId());
|
|
|
|
|
fileInfo.setTemplateName(req.getTemplateName());
|
|
|
|
|
@@ -659,10 +660,16 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
* @param analysisDirectionId 分析方向ID
|
|
|
|
|
* @param remarks 备注信息
|
|
|
|
|
* @param parentId 父目录ID
|
|
|
|
|
* @param fileSize
|
|
|
|
|
* @param fileSize 文件大小
|
|
|
|
|
* @param simulationPoolId 所属工况库id
|
|
|
|
|
* @param simulationPoolVersion 工况库版本
|
|
|
|
|
* @param simulationPoolTaskIds 关联工况id
|
|
|
|
|
* @return 创建后的文件元数据信息
|
|
|
|
|
*/
|
|
|
|
|
private FileMetadataInfo createFileMetadata(String filePath, String fileName, Integer fileType, String projectId, String analysisDirectionId, String remarks, Long parentId, Long fileSize) {
|
|
|
|
|
private FileMetadataInfo createFileMetadata(String filePath, String fileName, Integer fileType
|
|
|
|
|
, String projectId, String analysisDirectionId, String remarks, Long parentId, Long fileSize
|
|
|
|
|
, Integer simulationPoolId, String simulationPoolVersion,List<String> simulationPoolTaskIds
|
|
|
|
|
) {
|
|
|
|
|
FileMetadataInfo fileInfo = new FileMetadataInfo();
|
|
|
|
|
fileInfo.setObjectKey(filePath);
|
|
|
|
|
fileInfo.setBucketName(minioService.getBucketName());
|
|
|
|
|
@@ -670,6 +677,11 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
fileInfo.setProjectId(projectId);
|
|
|
|
|
fileInfo.setAnalysisDirectionId(analysisDirectionId);
|
|
|
|
|
fileInfo.setRemarks(remarks);
|
|
|
|
|
fileInfo.setSimulationPoolId(simulationPoolId);
|
|
|
|
|
fileInfo.setSimulationPoolVersion(simulationPoolVersion);
|
|
|
|
|
fileInfo.setSimulationPoolTaskIds(CollectionUtils.isEmpty(simulationPoolTaskIds) ? null :
|
|
|
|
|
String.join(";", simulationPoolTaskIds));
|
|
|
|
|
|
|
|
|
|
fileInfo.setDataType(DataTypeEnum.FILE.getValue());
|
|
|
|
|
fileInfo.setFileType(fileType);
|
|
|
|
|
fileInfo.setParentId(parentId);
|
|
|
|
|
@@ -1268,7 +1280,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(fileMinioObjectKey, req.getFileName(), req.getFileType(),
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), dirMetadataInfo.getId(), req.getFile().getSize());
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), dirMetadataInfo.getId(), req.getFile().getSize(),
|
|
|
|
|
req.getSimulationPoolId(),req.getSimulationPoolVersion(),req.getSimulationPoolTaskIds());
|
|
|
|
|
// 只有知识库的文件需要审核
|
|
|
|
|
// 1 知识库文件夹
|
|
|
|
|
boolean isknowledge = Objects.equals(DirTypeEnum.KNOWLEDGE_BASE_DIR.getValue(), dirMetadataInfo.getDirType());
|
|
|
|
|
@@ -1445,6 +1458,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
tempFileMetadataInfo.setProjectId(req.getProjectId());
|
|
|
|
|
tempFileMetadataInfo.setAnalysisDirectionId(req.getAnalysisDirectionId());
|
|
|
|
|
tempFileMetadataInfo.setRemarks(req.getRemarks());
|
|
|
|
|
tempFileMetadataInfo.setSimulationPoolId(req.getSimulationPoolId());
|
|
|
|
|
tempFileMetadataInfo.setSimulationPoolVersion(req.getSimulationPoolVersion());
|
|
|
|
|
tempFileMetadataInfo.setSimulationPoolTaskIds(CollectionUtils.isEmpty(req.getSimulationPoolTaskIds()) ? null :
|
|
|
|
|
String.join(";", req.getSimulationPoolTaskIds()));
|
|
|
|
|
|
|
|
|
|
fileMetadataInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
|
|
|
|
fileMetadataInfo.setApproveType(ApproveFileDataTypeEnum.MODIFY_METADATA_REVIEWING.getCode());
|
|
|
|
|
@@ -1468,6 +1485,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
fileMetadataInfo.setProjectId(req.getProjectId());
|
|
|
|
|
fileMetadataInfo.setAnalysisDirectionId(req.getAnalysisDirectionId());
|
|
|
|
|
fileMetadataInfo.setRemarks(req.getRemarks());
|
|
|
|
|
fileMetadataInfo.setSimulationPoolId(req.getSimulationPoolId());
|
|
|
|
|
fileMetadataInfo.setSimulationPoolVersion(req.getSimulationPoolVersion());
|
|
|
|
|
fileMetadataInfo.setSimulationPoolTaskIds(CollectionUtils.isEmpty(req.getSimulationPoolTaskIds()) ? null :
|
|
|
|
|
String.join(";", req.getSimulationPoolTaskIds()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fileMetadataInfoService.updateById(fileMetadataInfo);
|
|
|
|
|
@@ -1502,7 +1523,8 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
minioService.uploadFile(req.getFile(), newFileMinioObjectKey, null);
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(newFileMinioObjectKey, req.getFileName(), req.getFileType(),
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), fileMetadataInfo.getParentId(), req.getFile().getSize());
|
|
|
|
|
req.getProjectId(), req.getAnalysisDirectionId(), req.getRemarks(), fileMetadataInfo.getParentId(), req.getFile().getSize(),
|
|
|
|
|
req.getSimulationPoolId(),req.getSimulationPoolVersion(),req.getSimulationPoolTaskIds());
|
|
|
|
|
fileInfo.setFileGroupId(fileGroupId);
|
|
|
|
|
fileInfo.setVersionNo(versionNo + 1);
|
|
|
|
|
// 知识库修改
|
|
|
|
|
@@ -1611,7 +1633,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(avatarMinioObjectKey, newFilename, null,
|
|
|
|
|
null, null, null, parAvatarDirId, avatar.getSize());
|
|
|
|
|
null, null, null, parAvatarDirId, avatar.getSize(),null,null,null);
|
|
|
|
|
fileMetadataInfoService.save(fileInfo);
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
jsonObject.put("avatarId", fileInfo.getId());
|
|
|
|
|
@@ -1672,7 +1694,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(simulationParamMinioObjectKey, newFilename, null,
|
|
|
|
|
null, null, null, parSimulationParamDirId, paramFile.getSize());
|
|
|
|
|
null, null, null, parSimulationParamDirId, paramFile.getSize(),null,null,null);
|
|
|
|
|
// 设置文件状态为审批中 暂不可见
|
|
|
|
|
fileInfo.setApprovalStatus(ApprovalFileDataStatusEnum.PENDING.getKey());
|
|
|
|
|
fileInfo.setApproveType(ApproveFileDataTypeEnum.UPLOAD_REVIEWING.getCode());
|
|
|
|
|
@@ -1721,7 +1743,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(trainingMinioObjectKey, originalFilename, null,
|
|
|
|
|
null, null, null, parTrainModelDirId, trainModelFile.getSize());
|
|
|
|
|
null, null, null, parTrainModelDirId, trainModelFile.getSize(),null,null,null);
|
|
|
|
|
fileMetadataInfoService.save(fileInfo);
|
|
|
|
|
return SdmResponse.success(fileInfo.getId());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
@@ -1766,7 +1788,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
|
|
|
|
|
|
|
|
|
// 创建目录元数据并保存到数据库
|
|
|
|
|
FileMetadataInfo fileInfo = createFileMetadata(scriptFileMinioObjectKey, originalFilename, null,
|
|
|
|
|
null, null, null, parScriptDirId, scriptFile.getSize());
|
|
|
|
|
null, null, null, parScriptDirId, scriptFile.getSize(),null,null,null);
|
|
|
|
|
fileMetadataInfoService.save(fileInfo);
|
|
|
|
|
return SdmResponse.success(fileInfo.getId());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|