Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -229,6 +229,10 @@ public class FileMetadataInfo implements Serializable {
|
||||
@TableField(value = "analysisDirectionName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String analysisDirectionName;
|
||||
|
||||
@Schema(description = "知识库名称,只有列表展示使用")
|
||||
@TableField(value = "knowledgeBaseName", insertStrategy = FieldStrategy.NEVER,select = false,updateStrategy = FieldStrategy.NEVER)
|
||||
private String knowledgeBaseName;
|
||||
|
||||
@Schema(description = "关联工况库信息")
|
||||
@TableField(exist = false)
|
||||
private List<SimulationPoolInfo> simulationPoolInfoList;
|
||||
|
||||
@@ -960,6 +960,15 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
return SdmResponse.failed("文件不存在");
|
||||
}
|
||||
|
||||
if (DataTypeEnum.FILE.getValue() == fileMetadataInfo.getDataType()) {
|
||||
List<FileMetadataInfo> list = Arrays.asList(fileMetadataInfo);
|
||||
setProjectName(list);
|
||||
fileMetadataInfo = list.get(0);
|
||||
FileMetadataInfo dirMetadataInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, fileMetadataInfo.getParentId()).one();
|
||||
String knowledgeBaseName = extractRelativePath(dirMetadataInfo);
|
||||
fileMetadataInfo.setKnowledgeBaseName(knowledgeBaseName);
|
||||
}
|
||||
|
||||
// 封装返回结果
|
||||
FileMetadataInfoResp fileMetadataInfoResp = new FileMetadataInfoResp();
|
||||
BeanUtils.copyProperties(fileMetadataInfo, fileMetadataInfoResp);
|
||||
|
||||
@@ -133,4 +133,8 @@ public class KeyResultReq extends BaseReq {
|
||||
@Schema(description = "关键结果uuid列表")
|
||||
private List<String> keyResultIdList;
|
||||
|
||||
// -----------------归档输入输出文件使用---------------
|
||||
@Schema(description = "文件id列表")
|
||||
private List<Long> fileIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -2624,51 +2624,67 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
if (simulationRun == null) {
|
||||
return SdmResponse.failed("算例不存在");
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(req.getKeyResultIdList())) {
|
||||
for (String keyResultId : req.getKeyResultIdList()) {
|
||||
SimulationRunKeyResult keyResult = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getUuid, keyResultId).one();
|
||||
if (keyResult == null) {
|
||||
return SdmResponse.failed("关键结果不存在");
|
||||
}
|
||||
if (!KeyResultTypeEnum.VALUE.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
// 图片/曲线/报告结果同步
|
||||
CopyFileToTaskReq copyFileToTaskReq = new CopyFileToTaskReq();
|
||||
copyFileToTaskReq.setSourceFileId(keyResult.getFileId());
|
||||
// 归档输入和输出文件
|
||||
if (ObjectUtils.isNotEmpty(req.getFileType()) && CollectionUtils.isNotEmpty(req.getFileIds())) {
|
||||
for (Long fileId : req.getFileIds()) {
|
||||
CopyFileToTaskReq copyFileToTaskReq = new CopyFileToTaskReq();
|
||||
copyFileToTaskReq.setSourceFileId(fileId);
|
||||
|
||||
String dirName = FileBizTypeEnum.CLOUD_FILE.getDirName();
|
||||
if (KeyResultTypeEnum.CURVE.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
dirName = FileBizTypeEnum.CURVE_FILE.getDirName();
|
||||
} else if (KeyResultTypeEnum.DOCUMENT.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
dirName = FileBizTypeEnum.REPORT_FILE.getDirName();
|
||||
}
|
||||
Long parentDirId = getParentDirId(simulationRun.getTaskId(), dirName);
|
||||
copyFileToTaskReq.setParentDirId(parentDirId);
|
||||
SdmResponse response = dataFeignClient.copyFileToTask(copyFileToTaskReq);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("归档文件失败");
|
||||
}
|
||||
Long parentDirId = getParentDirId(simulationRun.getTaskId(), FileBizTypeEnum.getDirNameByValue(req.getFileType()));
|
||||
copyFileToTaskReq.setParentDirId(parentDirId);
|
||||
SdmResponse response = dataFeignClient.copyFileToTask(copyFileToTaskReq);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("归档输入输出文件失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 将算例下的指标分析值同步到任务指标
|
||||
List<SimulationPerformance> runPerformanceList = simulationPerformanceService.lambdaQuery()
|
||||
.eq(SimulationPerformance::getRunId, req.getRunId())
|
||||
.list();
|
||||
Map<String, String> resultValueMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(runPerformanceList)) {
|
||||
resultValueMap = runPerformanceList.stream()
|
||||
.filter(sp -> sp.getResultValue() != null)
|
||||
.collect(Collectors.toMap(SimulationPerformance::getNodeCode, SimulationPerformance::getResultValue));
|
||||
}
|
||||
List<SimulationPerformance> simulationTaskPerformances = simulationPerformanceService.lambdaQuery()
|
||||
.eq(SimulationPerformance::getTaskId, simulationRun.getTaskId())
|
||||
.isNull(SimulationPerformance::getRunId)
|
||||
.list();
|
||||
if (CollectionUtils.isNotEmpty(simulationTaskPerformances)) {
|
||||
for (SimulationPerformance simulationTaskPerformance : simulationTaskPerformances) {
|
||||
simulationTaskPerformance.setResultValue(resultValueMap.get(simulationTaskPerformance.getNodeCode()));
|
||||
// 归档关键结果
|
||||
if (CollectionUtils.isNotEmpty(req.getKeyResultIdList())) {
|
||||
for (String keyResultId : req.getKeyResultIdList()) {
|
||||
SimulationRunKeyResult keyResult = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getUuid, keyResultId).one();
|
||||
if (keyResult == null) {
|
||||
return SdmResponse.failed("关键结果不存在");
|
||||
}
|
||||
if (!KeyResultTypeEnum.VALUE.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
// 图片/曲线/报告结果同步
|
||||
CopyFileToTaskReq copyFileToTaskReq = new CopyFileToTaskReq();
|
||||
copyFileToTaskReq.setSourceFileId(keyResult.getFileId());
|
||||
|
||||
String dirName = FileBizTypeEnum.CLOUD_FILE.getDirName();
|
||||
if (KeyResultTypeEnum.CURVE.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
dirName = FileBizTypeEnum.CURVE_FILE.getDirName();
|
||||
} else if (KeyResultTypeEnum.DOCUMENT.getKeyResultType().equals(keyResult.getKeyResultType())) {
|
||||
dirName = FileBizTypeEnum.REPORT_FILE.getDirName();
|
||||
}
|
||||
Long parentDirId = getParentDirId(simulationRun.getTaskId(), dirName);
|
||||
copyFileToTaskReq.setParentDirId(parentDirId);
|
||||
SdmResponse response = dataFeignClient.copyFileToTask(copyFileToTaskReq);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("归档关键结果文件失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 将算例下的指标分析值同步到任务指标
|
||||
List<SimulationPerformance> runPerformanceList = simulationPerformanceService.lambdaQuery()
|
||||
.eq(SimulationPerformance::getRunId, req.getRunId())
|
||||
.list();
|
||||
Map<String, String> resultValueMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(runPerformanceList)) {
|
||||
resultValueMap = runPerformanceList.stream()
|
||||
.filter(sp -> sp.getResultValue() != null)
|
||||
.collect(Collectors.toMap(SimulationPerformance::getNodeCode, SimulationPerformance::getResultValue));
|
||||
}
|
||||
List<SimulationPerformance> simulationTaskPerformances = simulationPerformanceService.lambdaQuery()
|
||||
.eq(SimulationPerformance::getTaskId, simulationRun.getTaskId())
|
||||
.isNull(SimulationPerformance::getRunId)
|
||||
.list();
|
||||
if (CollectionUtils.isNotEmpty(simulationTaskPerformances)) {
|
||||
for (SimulationPerformance simulationTaskPerformance : simulationTaskPerformances) {
|
||||
simulationTaskPerformance.setResultValue(resultValueMap.get(simulationTaskPerformance.getNodeCode()));
|
||||
}
|
||||
simulationPerformanceService.updateBatchById(simulationTaskPerformances);
|
||||
}
|
||||
simulationPerformanceService.updateBatchById(simulationTaskPerformances);
|
||||
}
|
||||
}
|
||||
return SdmResponse.success();
|
||||
|
||||
Reference in New Issue
Block a user