feat:新增兼容任务下上传关键结果逻辑
This commit is contained in:
@@ -33,6 +33,10 @@ public class SimulationRunKeyResult implements Serializable {
|
||||
@ApiModelProperty(value = "所属Run UUID", required = true)
|
||||
private String runId;
|
||||
|
||||
@TableField("taskId")
|
||||
@ApiModelProperty(value = "所属Task UUID", required = true)
|
||||
private String taskId;
|
||||
|
||||
@TableField("keyResultType")
|
||||
@ApiModelProperty(value = "关键性能结果类型 1-图片/动画 2-曲线 3-报告 4-数值")
|
||||
private Integer keyResultType;
|
||||
|
||||
@@ -1136,8 +1136,14 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
simulationRunKeyResult.setUpdater(ThreadLocalContext.getUserId());
|
||||
// 外围调用不关心dirId,只传keyResultType-关键结果类型,所以需要根据算例id和keyResultType获取到上传到哪个结果目录下
|
||||
if (req.getDirId() == null) {
|
||||
setDirId(req);
|
||||
log.info("[addSimulationKeyResult] keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
|
||||
if (StringUtils.isNotBlank(req.getRunId())) {
|
||||
setDirId(req);
|
||||
log.info("[addSimulationKeyResult] run keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
|
||||
} else if (StringUtils.isNotBlank(req.getTaskId())) {
|
||||
// 如果是任务下的关键结果 前端拿不到dirId 不会传 需要后端识别
|
||||
req.setDirId(getParentDirId(req.getTaskId(), fileBizTypeService.getFileName(String.valueOf(req.getFileTypeDictValue()))));
|
||||
log.info("[addSimulationKeyResult] task keyResultType:{},dirId:{}", req.getKeyResultType(), req.getDirId());
|
||||
}
|
||||
}
|
||||
// 上传文件
|
||||
if (req.getFile() != null) {
|
||||
@@ -1464,12 +1470,23 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery()
|
||||
.eq(ObjectUtils.isNotEmpty(req.getRunId()),SimulationRunKeyResult::getRunId, req.getRunId())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getKeyResultType()),SimulationRunKeyResult::getKeyResultType, req.getKeyResultType())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getFileId()),SimulationRunKeyResult::getFileId, req.getFileId())
|
||||
.orderByAsc(SimulationRunKeyResult::getFileId)
|
||||
.list();
|
||||
|
||||
LambdaQueryWrapper<SimulationRunKeyResult> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(req.getRunId())) {
|
||||
queryWrapper.eq(SimulationRunKeyResult::getRunId, req.getRunId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(req.getTaskId())) {
|
||||
queryWrapper.eq(SimulationRunKeyResult::getTaskId, req.getTaskId());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(req.getKeyResultType())) {
|
||||
queryWrapper.eq(SimulationRunKeyResult::getKeyResultType, req.getKeyResultType());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(req.getFileId())) {
|
||||
queryWrapper.eq(SimulationRunKeyResult::getFileId, req.getFileId());
|
||||
}
|
||||
queryWrapper.orderByAsc(SimulationRunKeyResult::getFileId);
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.getBaseMapper().selectList(queryWrapper);
|
||||
|
||||
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
|
||||
|
||||
// 批量查询文件信息并回设name
|
||||
@@ -2936,6 +2953,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
simulationRunKeyResult.setId(null);
|
||||
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
|
||||
simulationRunKeyResult.setRunId(null);
|
||||
simulationRunKeyResult.setTaskId(simulationRun.getTaskId());
|
||||
simulationRunKeyResult.setFileId(response.getData());
|
||||
taskKeyResultList.add(simulationRunKeyResult);
|
||||
}
|
||||
@@ -3041,6 +3059,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
// 同时生成一份keyResult到表里,因为任务下的曲线预览也需要展示物理量和单位
|
||||
SimulationRunKeyResult simulationRunKeyResult = new SimulationRunKeyResult();
|
||||
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
|
||||
simulationRunKeyResult.setTaskId(req.getUuid());
|
||||
simulationRunKeyResult.setXQuantityType(sourceFile.getXQuantityType());
|
||||
simulationRunKeyResult.setXUnits(sourceFile.getXUnits());
|
||||
simulationRunKeyResult.setYQuantityType(sourceFile.getYQuantityType());
|
||||
|
||||
Reference in New Issue
Block a user