fix:指标归档修改&关键结果名称显示修改
This commit is contained in:
@@ -135,6 +135,8 @@ public class KeyResultReq extends BaseReq {
|
|||||||
// ------------------归档关键结果使用-----------------
|
// ------------------归档关键结果使用-----------------
|
||||||
@Schema(description = "关键结果uuid列表")
|
@Schema(description = "关键结果uuid列表")
|
||||||
private List<String> keyResultIdList;
|
private List<String> keyResultIdList;
|
||||||
|
@Schema(description = "数值指标id列表")
|
||||||
|
private List<Integer> performanceIdList;
|
||||||
|
|
||||||
// -----------------归档输入输出文件使用---------------
|
// -----------------归档输入输出文件使用---------------
|
||||||
@Schema(description = "文件id列表")
|
@Schema(description = "文件id列表")
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.sdm.common.entity.resp.PageDataResp;
|
|||||||
import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
||||||
import com.sdm.common.entity.resp.capability.ReportTemplateResp;
|
import com.sdm.common.entity.resp.capability.ReportTemplateResp;
|
||||||
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
import com.sdm.common.entity.resp.data.BatchAddFileInfoResp;
|
||||||
|
import com.sdm.common.entity.req.data.QueryFileReq;
|
||||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||||
import com.sdm.common.entity.resp.data.SimulationTaskResultCurveResp;
|
import com.sdm.common.entity.resp.data.SimulationTaskResultCurveResp;
|
||||||
import com.sdm.common.entity.resp.flowable.ProcessInstanceDetailResponse;
|
import com.sdm.common.entity.resp.flowable.ProcessInstanceDetailResponse;
|
||||||
@@ -1468,6 +1469,40 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
|||||||
.orderByAsc(SimulationRunKeyResult::getFileId)
|
.orderByAsc(SimulationRunKeyResult::getFileId)
|
||||||
.list();
|
.list();
|
||||||
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
|
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
|
||||||
|
|
||||||
|
// 批量查询文件信息并回设name
|
||||||
|
if (CollectionUtils.isNotEmpty(runKeyResults)) {
|
||||||
|
// 提取所有fileId
|
||||||
|
List<Long> fileIdList = runKeyResults.stream()
|
||||||
|
.map(SimulationRunKeyResult::getFileId)
|
||||||
|
.filter(ObjectUtils::isNotEmpty)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(fileIdList)) {
|
||||||
|
// 批量查询文件信息
|
||||||
|
QueryFileReq queryFileReq = new QueryFileReq();
|
||||||
|
queryFileReq.setFileIdList(fileIdList);
|
||||||
|
SdmResponse<List<FileMetadataInfoResp>> fileResponse = dataFeignClient.queryFileListByIdList(queryFileReq);
|
||||||
|
|
||||||
|
if (fileResponse.isSuccess() && CollectionUtils.isNotEmpty(fileResponse.getData())) {
|
||||||
|
// 构建fileId -> originalName的映射
|
||||||
|
Map<Long, String> fileIdToNameMap = fileResponse.getData().stream()
|
||||||
|
.collect(Collectors.toMap(FileMetadataInfoResp::getId, FileMetadataInfoResp::getOriginalName, (v1, v2) -> v1));
|
||||||
|
|
||||||
|
// 回设name
|
||||||
|
for (SimulationRunKeyResult keyResult : runKeyResults) {
|
||||||
|
if (keyResult.getFileId() != null) {
|
||||||
|
String originalName = fileIdToNameMap.get(keyResult.getFileId());
|
||||||
|
if (originalName != null) {
|
||||||
|
keyResult.setName(originalName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2899,27 +2934,22 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
simulationKeyResultService.saveBatch(taskKeyResultList);
|
simulationKeyResultService.saveBatch(taskKeyResultList);
|
||||||
} else {
|
} else if (CollectionUtils.isNotEmpty(req.getPerformanceIdList())) {
|
||||||
// 将算例下的指标分析值同步到任务指标
|
// 将算例下的指标同步到任务指标
|
||||||
List<SimulationPerformance> runPerformanceList = simulationPerformanceService.lambdaQuery()
|
List<SimulationPerformance> runPerformanceList = simulationPerformanceService.lambdaQuery()
|
||||||
.eq(SimulationPerformance::getRunId, req.getRunId())
|
.in(SimulationPerformance::getId, req.getPerformanceIdList())
|
||||||
.list();
|
.list();
|
||||||
Map<String, String> resultValueMap = new HashMap<>();
|
List<String> performanceCodes = runPerformanceList.stream().map(SimulationPerformance::getNodeCode).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(runPerformanceList)) {
|
// 把对应的任务下的指标删除后新增
|
||||||
resultValueMap = runPerformanceList.stream()
|
simulationPerformanceService.lambdaUpdate()
|
||||||
.filter(sp -> sp.getResultValue() != null)
|
|
||||||
.collect(Collectors.toMap(SimulationPerformance::getNodeCode, SimulationPerformance::getResultValue));
|
|
||||||
}
|
|
||||||
List<SimulationPerformance> simulationTaskPerformances = simulationPerformanceService.lambdaQuery()
|
|
||||||
.eq(SimulationPerformance::getTaskId, simulationRun.getTaskId())
|
.eq(SimulationPerformance::getTaskId, simulationRun.getTaskId())
|
||||||
.isNull(SimulationPerformance::getRunId)
|
.isNull(SimulationPerformance::getRunId)
|
||||||
.list();
|
.in(SimulationPerformance::getNodeCode, performanceCodes).remove();
|
||||||
if (CollectionUtils.isNotEmpty(simulationTaskPerformances)) {
|
runPerformanceList.forEach(simulationPerformance -> {
|
||||||
for (SimulationPerformance simulationTaskPerformance : simulationTaskPerformances) {
|
simulationPerformance.setRunId(null);
|
||||||
simulationTaskPerformance.setResultValue(resultValueMap.get(simulationTaskPerformance.getNodeCode()));
|
simulationPerformance.setId(null);
|
||||||
}
|
});
|
||||||
simulationPerformanceService.updateBatchById(simulationTaskPerformances);
|
simulationPerformanceService.saveBatch(runPerformanceList);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SdmResponse.success();
|
return SdmResponse.success();
|
||||||
|
|||||||
Reference in New Issue
Block a user