feat:算例关键结果属性
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sdm.data.model.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sdm.common.entity.enums.FileBizTypeEnum;
|
||||
import com.sdm.common.entity.req.data.BaseReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -11,6 +12,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class GetSimulationTaskFileReq extends BaseReq {
|
||||
@Schema(description = "文件所属项目节点uuid")
|
||||
@JsonProperty(value = "project")
|
||||
private String uuid;
|
||||
|
||||
@Schema(description = "文件类型", implementation = FileBizTypeEnum.class)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sdm.project.common;
|
||||
|
||||
import com.sdm.common.entity.enums.ApprovalFileDataStatusEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
public enum KeyResultTypeEnum {
|
||||
IMAGE("图片/动画", 1, "图片结果"),
|
||||
VALUE("数值", 2, "曲线结果"),
|
||||
DOCUMENT("报告", 3, "报告结果"),
|
||||
CURVE("曲线", 4, "数值结果");
|
||||
|
||||
private final String name;
|
||||
private final Integer keyResultType;
|
||||
private final String dirName;
|
||||
|
||||
KeyResultTypeEnum(String name, Integer keyResultType, String dirName) {
|
||||
this.name = name;
|
||||
this.keyResultType = keyResultType;
|
||||
this.dirName = dirName;
|
||||
}
|
||||
|
||||
public static String getDirNameByType(Integer keyResultType) {
|
||||
for (KeyResultTypeEnum status : values()) {
|
||||
if (Objects.equals(status.getKeyResultType(), keyResultType)) {
|
||||
return status.getDirName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,11 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.req.GetRunVersionReq;
|
||||
import com.sdm.project.model.req.ProjectTreeTagReq;
|
||||
import com.sdm.project.model.req.SpdmAddTaskRunReq;
|
||||
import com.sdm.project.model.req.SpdmTaskRunReq;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -77,10 +77,10 @@ public class SimulationRunController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建算例文件夹
|
||||
* 查询算例文件夹及文件
|
||||
*/
|
||||
@PostMapping(value = "/queryRunDir")
|
||||
public SdmResponse queryRunDir(@RequestBody QueryDirReq req) {
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryRunDir(@RequestBody QueryDirReq req) {
|
||||
return runService.queryRunDir(req);
|
||||
}
|
||||
|
||||
@@ -112,4 +112,34 @@ public class SimulationRunController {
|
||||
return runService.getRunVersion(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务执行后 算例录入关键结果
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addSimulationKeyResult", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public SdmResponse addSimulationKeyResult(KeyResultReq req) {
|
||||
return runService.addSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 算例关键结果查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/listSimulationKeyResult")
|
||||
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(@RequestBody KeyResultReq req) {
|
||||
return runService.listSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除算例关键结果
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/deleteSimulationKeyResult")
|
||||
public SdmResponse deleteSimulationKeyResult(@RequestBody KeyResultReq req) {
|
||||
return runService.deleteSimulationKeyResult(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sdm.project.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SimulationKeyResultMapper extends BaseMapper<SimulationRunKeyResult> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.sdm.project.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("simulation_run_key_result")
|
||||
@ApiModel(value="simulationRunKeyResult对象", description="任务执行-图片/动画/数值/文件关键性能结果实体")
|
||||
public class SimulationRunKeyResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@TableField("uuid")
|
||||
@ApiModelProperty(value = "关键结果唯一ID", required = true)
|
||||
private String uuid;
|
||||
|
||||
@TableField("runId")
|
||||
@ApiModelProperty(value = "所属Run UUID", required = true)
|
||||
private String runId;
|
||||
|
||||
@TableField("keyResultType")
|
||||
@ApiModelProperty(value = "关键性能结果类型 1-图片/动画 2-曲线 3-报告 4-数值")
|
||||
private Integer keyResultType;
|
||||
|
||||
@TableField("name")
|
||||
@ApiModelProperty(value = "结果名称")
|
||||
private String name;
|
||||
|
||||
@TableField("fileId")
|
||||
@ApiModelProperty(value = "关联文件id")
|
||||
private Long fileId;
|
||||
|
||||
@TableField("quantityType")
|
||||
@ApiModelProperty(value = "物理量类型")
|
||||
private String quantityType;
|
||||
|
||||
@TableField("units")
|
||||
@ApiModelProperty(value = "结果单位")
|
||||
private String units;
|
||||
|
||||
@TableField("max")
|
||||
@ApiModelProperty(value = "最大数值")
|
||||
private String max;
|
||||
|
||||
@TableField("min")
|
||||
@ApiModelProperty(value = "最小数值")
|
||||
private String min;
|
||||
|
||||
@TableField("value")
|
||||
@ApiModelProperty(value = "数值")
|
||||
private String value;
|
||||
|
||||
@TableField("description")
|
||||
@ApiModelProperty(value = "描述信息")
|
||||
private String description;
|
||||
|
||||
@TableField("xQuantityType")
|
||||
@ApiModelProperty(value = "x轴物理量(曲线结果使用)")
|
||||
private String xQuantityType;
|
||||
|
||||
@TableField("xUnits")
|
||||
@ApiModelProperty(value = "x轴结果单位(曲线结果使用)")
|
||||
private String xUnits;
|
||||
|
||||
@TableField("yQuantityType")
|
||||
@ApiModelProperty(value = "y轴物理量(曲线结果使用)")
|
||||
private String yQuantityType;
|
||||
|
||||
@TableField("yUnits")
|
||||
@ApiModelProperty(value = "y轴结果单位(曲线结果使用)")
|
||||
private String yUnits;
|
||||
|
||||
@TableField("creator")
|
||||
@ApiModelProperty(value = "创建人ID")
|
||||
private Long creator;
|
||||
|
||||
@TableField("createTime")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField("updater")
|
||||
@ApiModelProperty(value = "更新人ID")
|
||||
private Long updater;
|
||||
|
||||
@TableField("updateTime")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -12,9 +13,11 @@ public class GetRunVersionReq {
|
||||
/**
|
||||
* 算例uuid
|
||||
*/
|
||||
@Schema(description = "算例uuid")
|
||||
private String runId;
|
||||
/**
|
||||
* 任务uuid
|
||||
*/
|
||||
@Schema(description = "任务uuid")
|
||||
private String taskId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import com.sdm.common.entity.BaseReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Data
|
||||
public class KeyResultReq extends BaseReq {
|
||||
|
||||
private String uuid;
|
||||
|
||||
@Schema(description = "算例uuid")
|
||||
private String runId;
|
||||
|
||||
@Schema(description = "关键性能结果类型 1-图片/动画 2-曲线 3-报告 4-数值")
|
||||
private Integer keyResultType;
|
||||
|
||||
@Schema(description = "结果名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "文件id")
|
||||
private Long fileId;
|
||||
|
||||
@Schema(description = "物理量")
|
||||
private String quantityType;
|
||||
|
||||
@Schema(description = "结果单位")
|
||||
private String units;
|
||||
|
||||
@Schema(description = "最大数值")
|
||||
private String maxValue;
|
||||
|
||||
@Schema(description = "最小数值")
|
||||
private String minValue;
|
||||
|
||||
@Schema(description = "数值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "描述信息")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "x轴物理量(曲线结果使用)")
|
||||
private String xQuantityType;
|
||||
|
||||
@Schema(description = "x轴结果单位(曲线结果使用)")
|
||||
private String xUnits;
|
||||
|
||||
@Schema(description = "y轴物理量(曲线结果使用)")
|
||||
private String yQuantityType;
|
||||
|
||||
@Schema(description = "y轴结果单位(曲线结果使用)")
|
||||
private String yUnits;
|
||||
|
||||
|
||||
@Schema(description = "上传文件所在父目录id")
|
||||
private Long dirId;
|
||||
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "文件类型")
|
||||
private String fileType;
|
||||
|
||||
@Schema(description = "文件")
|
||||
private MultipartFile file;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.sdm.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
|
||||
public interface ISimulationKeyResultService extends IService<SimulationRunKeyResult> {
|
||||
|
||||
}
|
||||
@@ -4,12 +4,12 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.project.model.req.GetRunVersionReq;
|
||||
import com.sdm.project.model.req.ProjectTreeTagReq;
|
||||
import com.sdm.project.model.req.SpdmAddTaskRunReq;
|
||||
import com.sdm.project.model.req.SpdmTaskRunReq;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,7 +34,7 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse createRunDir(CreateDirReq req);
|
||||
|
||||
SdmResponse queryRunDir(QueryDirReq req);
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryRunDir(QueryDirReq req);
|
||||
|
||||
SdmResponse uploadRunFiles(UploadFilesReq req);
|
||||
|
||||
@@ -42,4 +42,10 @@ public interface ISimulationRunService extends IService<SimulationRun> {
|
||||
|
||||
SdmResponse<RunVersionInfoResp> getRunVersion(GetRunVersionReq req);
|
||||
|
||||
SdmResponse addSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
SdmResponse deleteSimulationKeyResult(KeyResultReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.sdm.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.project.dao.SimulationKeyResultMapper;
|
||||
import com.sdm.project.model.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.service.ISimulationKeyResultService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SimulationKeyResultServiceImpl extends ServiceImpl<SimulationKeyResultMapper, SimulationRunKeyResult> implements ISimulationKeyResultService {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.sdm.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
@@ -11,30 +14,27 @@ import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.QueryDirReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.data.FileMetadataInfoResp;
|
||||
import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.feign.inter.data.IDataFeignClient;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.project.common.KeyResultTypeEnum;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.common.RunPerformanceStatusEnum;
|
||||
import com.sdm.project.dao.SimulationProjectMapper;
|
||||
import com.sdm.project.dao.SimulationRunMapper;
|
||||
import com.sdm.project.model.bo.TaskNodeTag;
|
||||
import com.sdm.project.model.entity.SimulationPerformance;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.entity.SimulationTask;
|
||||
import com.sdm.project.model.entity.SimulationTaskMember;
|
||||
import com.sdm.project.model.entity.*;
|
||||
import com.sdm.project.model.po.NodeAllBase;
|
||||
import com.sdm.project.model.po.ProjectNodePo;
|
||||
import com.sdm.project.model.po.RunNodePo;
|
||||
import com.sdm.project.model.po.TaskNodePo;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationPerformanceService;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
import com.sdm.project.service.ISimulationTaskMemberService;
|
||||
import com.sdm.project.service.ISimulationTaskService;
|
||||
import com.sdm.project.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -74,6 +74,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
@Autowired
|
||||
private ISimulationPerformanceService simulationPerformanceService;
|
||||
|
||||
@Autowired
|
||||
private ISimulationKeyResultService simulationKeyResultService;
|
||||
|
||||
@Autowired
|
||||
SysUserFeignClientImpl sysUserFeignClient;
|
||||
|
||||
@@ -485,7 +488,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
} else {
|
||||
SimulationRun simulationRun = new SimulationRun();
|
||||
// 设置算例的文件夹路径 挂在所属任务下面
|
||||
SdmResponse<FileMetadataInfoResp> fileMetadataInfoResp = dataFeignClient.queryFileMetadataInfo(simulationTask.getUuid(), NodeTypeEnum.TASK.getValue());
|
||||
SdmResponse<FileMetadataInfoResp> fileMetadataInfoResp = dataFeignClient.queryFileMetadataInfo(simulationTask.getUuid(), NodeTypeEnum.TASK.getValue(), null);
|
||||
if (fileMetadataInfoResp.getData() != null) {
|
||||
simulationRun.setFolderId(fileMetadataInfoResp.getData().getId());
|
||||
}
|
||||
@@ -556,9 +559,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
// 删除算例目录
|
||||
DelDirReq delDirReq = new DelDirReq();
|
||||
delDirReq.setDelUuid(simulationRun.getUuid());
|
||||
log.info("调用删除文件夹的参数为:{}", req);
|
||||
log.info("删除算例调用删除文件夹的参数为:{}", req);
|
||||
SdmResponse response = dataFeignClient.delDir(delDirReq);
|
||||
log.info("调用删除文件夹的返回值为:{}", response);
|
||||
log.info("删除算例调用删除文件夹的返回值为:{}", response);
|
||||
return SdmResponse.success(response);
|
||||
}
|
||||
|
||||
@@ -582,7 +585,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
public SdmResponse createRunDir(CreateDirReq req) {
|
||||
CreateDirReq createDirReq = new CreateDirReq();
|
||||
// 获取算例文件夹id
|
||||
SdmResponse<FileMetadataInfoResp> fileMetadataInfoResp = dataFeignClient.queryFileMetadataInfo(req.getUuId(), NodeTypeEnum.RUN.getValue());
|
||||
SdmResponse<FileMetadataInfoResp> fileMetadataInfoResp = dataFeignClient.queryFileMetadataInfo(req.getUuId(), NodeTypeEnum.RUN.getValue(), null);
|
||||
if (fileMetadataInfoResp.getData() != null) {
|
||||
createDirReq.setParDirId(fileMetadataInfoResp.getData().getId());
|
||||
}
|
||||
@@ -595,7 +598,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse queryRunDir(QueryDirReq req) {
|
||||
public SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> queryRunDir(QueryDirReq req) {
|
||||
return dataFeignClient.queryDir(req);
|
||||
}
|
||||
|
||||
@@ -641,6 +644,59 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return SdmResponse.success(relatedRunsResp.stream().filter(i -> StringUtils.equals(i.getUuid(), targetRun.getUuid())).findFirst().get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse addSimulationKeyResult(KeyResultReq req) {
|
||||
SimulationRunKeyResult simulationRunKeyResult = new SimulationRunKeyResult();
|
||||
BeanUtils.copyProperties(req, simulationRunKeyResult);
|
||||
simulationRunKeyResult.setUuid(RandomUtil.generateString(32));
|
||||
simulationRunKeyResult.setCreator(ThreadLocalContext.getUserId());
|
||||
simulationRunKeyResult.setUpdater(ThreadLocalContext.getUserId());
|
||||
// 外围调用不关心dirId,只传keyResultType-关键结果类型,所以需要根据算例id和keyResultType获取到上传到哪个结果目录下
|
||||
if (req.getDirId() == null) {
|
||||
setDirId(req);
|
||||
}
|
||||
// 上传文件
|
||||
if (req.getFile() != null) {
|
||||
UploadFilesReq filesReq = new UploadFilesReq();
|
||||
BeanUtils.copyProperties(req, filesReq);
|
||||
SdmResponse response = uploadRunFiles(filesReq);
|
||||
if (response.isSuccess() && response.getData() != null) {
|
||||
JSONObject result = JSONObject.from(response.getData());
|
||||
simulationRunKeyResult.setFileId((Long) result.get("fileId"));
|
||||
} else {
|
||||
return SdmResponse.failed("上传文件失败");
|
||||
}
|
||||
}
|
||||
if (!simulationKeyResultService.save(simulationRunKeyResult)) {
|
||||
return SdmResponse.failed("添加关键结果失败");
|
||||
}
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getRunId, req.getRunId())
|
||||
.eq(SimulationRunKeyResult::getKeyResultType, req.getKeyResultType()).list();
|
||||
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
|
||||
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse deleteSimulationKeyResult(KeyResultReq req) {
|
||||
// 删除结果
|
||||
simulationKeyResultService.lambdaUpdate().eq(SimulationRunKeyResult::getUuid, req.getUuid()).remove();
|
||||
// 删除文件
|
||||
DelDirReq delDirReq = new DelDirReq();
|
||||
delDirReq.setDelDirId(req.getFileId());
|
||||
log.info("删除关键结果调用删除文件夹的参数为:{}", req);
|
||||
SdmResponse response = dataFeignClient.delDir(delDirReq);
|
||||
log.info("删除关键结果调用删除文件夹的返回值为:{}", response);
|
||||
return SdmResponse.success(response);
|
||||
}
|
||||
|
||||
private List<RunVersionInfoResp> buildRunTreeWithMap(List<RunVersionInfoResp> allRuns) {
|
||||
// 按父节点ID分组
|
||||
Map<String, List<RunVersionInfoResp>> childrenMap = allRuns.stream().filter(run -> StringUtils.isNotEmpty(run.getParentId()))
|
||||
@@ -656,4 +712,21 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
return allRuns.stream().filter(run -> StringUtils.isEmpty(run.getParentId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void setDirId(KeyResultReq req) {
|
||||
String dirName = KeyResultTypeEnum.getDirNameByType(req.getKeyResultType());
|
||||
QueryDirReq queryDirReq = new QueryDirReq();
|
||||
queryDirReq.setUuid(req.getRunId());
|
||||
queryDirReq.setCurrent(1);
|
||||
queryDirReq.setSize(10);
|
||||
SdmResponse<PageDataResp<List<FileMetadataInfoResp>>> sdmResponse = queryRunDir(queryDirReq);
|
||||
if (sdmResponse.getData() != null) {
|
||||
List<FileMetadataInfoResp> fileMetadataInfoRespList = sdmResponse.getData().getData();
|
||||
if (CollectionUtils.isNotEmpty(fileMetadataInfoRespList)) {
|
||||
fileMetadataInfoRespList.stream().filter(i -> StringUtils.equals(i.getOriginalName(), dirName)).findFirst().ifPresent(i -> {
|
||||
req.setDirId(i.getId());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user