Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
# Conflicts: # data/src/main/java/com/sdm/data/controller/DataFileController.java # data/src/main/java/com/sdm/data/service/IDataFileService.java # data/src/main/java/com/sdm/data/service/impl/MinioFileIDataFileServiceImpl.java # project/src/main/java/com/sdm/project/controller/SimulationRunController.java # project/src/main/java/com/sdm/project/service/ISimulationRunService.java # project/src/main/java/com/sdm/project/service/impl/SimulationRunServiceImpl.java
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,24 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
return nodeService.getAllNodeByProjectIdAndType(uuid, nextNodeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点下的task列表
|
||||
*/
|
||||
@GetMapping("/getNodeTaskList")
|
||||
@Operation(summary = "获取节点下的task列表", description = "获取节点下的task列表")
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(@RequestParam(value = "uuid") String uuid) {
|
||||
return nodeService.getNodeTaskList(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取task下的run
|
||||
*/
|
||||
@GetMapping("/getNodeTaskRunList")
|
||||
@Operation(summary = "获取task下的run", description = "获取task下的run")
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(@RequestParam(value = "uuid") String uuid) {
|
||||
return nodeService.getTaskRunList(uuid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户组项目统计
|
||||
|
||||
@@ -4,7 +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.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import com.sdm.project.service.ISimulationRunService;
|
||||
@@ -75,10 +79,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);
|
||||
}
|
||||
|
||||
@@ -110,6 +114,36 @@ 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;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.project.model.entity.SimulationNode;
|
||||
import com.sdm.project.model.req.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,6 +36,10 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getAllNodeByProjectIdAndType(String uuid, String nextNodeType);
|
||||
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(String uuid);
|
||||
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(String uuid);
|
||||
|
||||
SdmResponse getUserGroupProjectStatistics(Long userGroupId, Long userId);
|
||||
|
||||
SdmResponse getUserGroupTaskCompleteStatistics(GetUserGroupTaskCompleteStatisticsReq req);
|
||||
|
||||
@@ -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,8 +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.entity.SimulationRunKeyResult;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.resp.RunVersionInfoResp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -32,7 +36,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);
|
||||
|
||||
@@ -40,5 +44,11 @@ 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);
|
||||
|
||||
void generateReport(SpdmReportReq req, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -756,6 +756,49 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getNodeTaskList(String uuid) {
|
||||
if(ObjectUtils.isEmpty(uuid)){
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<SimulationTask> simulationTasks = simulationTaskService.lambdaQuery().eq(SimulationTask::getNodeId, uuid).list();
|
||||
if(CollectionUtils.isEmpty(simulationTasks)){
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<AllNodeByProjectIdAndTypeResp> allNodeByProjectIdAndTypeRespList = new ArrayList<>();
|
||||
simulationTasks.forEach(simulationTask -> {
|
||||
AllNodeByProjectIdAndTypeResp allNodeByProjectIdAndTypeResp = new AllNodeByProjectIdAndTypeResp();
|
||||
allNodeByProjectIdAndTypeResp.setId(simulationTask.getId().longValue());
|
||||
allNodeByProjectIdAndTypeResp.setUuid(simulationTask.getUuid());
|
||||
allNodeByProjectIdAndTypeResp.setNodeName(simulationTask.getTaskName());
|
||||
allNodeByProjectIdAndTypeResp.setNodeType(NodeTypeEnum.TASK.getValue());
|
||||
allNodeByProjectIdAndTypeRespList.add(allNodeByProjectIdAndTypeResp);
|
||||
});
|
||||
|
||||
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<List<AllNodeByProjectIdAndTypeResp>> getTaskRunList(String uuid) {
|
||||
if(ObjectUtils.isEmpty(uuid)){
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<SimulationRun> simulationRunList = simulationRunService.lambdaQuery().eq(SimulationRun::getTaskId, uuid).list();
|
||||
if(CollectionUtils.isEmpty(simulationRunList)){
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<AllNodeByProjectIdAndTypeResp> allNodeByProjectIdAndTypeRespList = new ArrayList<>();
|
||||
simulationRunList.forEach(simulationRun -> {
|
||||
AllNodeByProjectIdAndTypeResp allNodeByProjectIdAndTypeResp = new AllNodeByProjectIdAndTypeResp();
|
||||
allNodeByProjectIdAndTypeResp.setId(simulationRun.getId().longValue());
|
||||
allNodeByProjectIdAndTypeResp.setUuid(simulationRun.getUuid());
|
||||
allNodeByProjectIdAndTypeResp.setNodeName(simulationRun.getRunName());
|
||||
allNodeByProjectIdAndTypeResp.setNodeType(NodeTypeEnum.RUN.getValue());
|
||||
allNodeByProjectIdAndTypeRespList.add(allNodeByProjectIdAndTypeResp);
|
||||
});
|
||||
return SdmResponse.success(allNodeByProjectIdAndTypeRespList);
|
||||
}
|
||||
|
||||
public static void setTagProperty(Object obj, String propertyName, Object value) throws Exception {
|
||||
Class<?> clazz = obj.getClass();
|
||||
Field field = clazz.getDeclaredField(propertyName);
|
||||
|
||||
@@ -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,28 +1,31 @@
|
||||
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;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.*;
|
||||
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.TaskNode;
|
||||
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;
|
||||
@@ -34,6 +37,7 @@ import com.sdm.project.service.ISimulationRunService;
|
||||
import com.sdm.project.service.ISimulationTaskMemberService;
|
||||
import com.sdm.project.service.ISimulationTaskService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import com.sdm.project.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -76,6 +80,9 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
@Autowired
|
||||
private ISimulationPerformanceService simulationPerformanceService;
|
||||
|
||||
@Autowired
|
||||
private ISimulationKeyResultService simulationKeyResultService;
|
||||
|
||||
@Autowired
|
||||
SysUserFeignClientImpl sysUserFeignClient;
|
||||
|
||||
@@ -489,7 +496,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());
|
||||
}
|
||||
@@ -560,9 +567,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);
|
||||
}
|
||||
|
||||
@@ -586,7 +593,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());
|
||||
}
|
||||
@@ -599,7 +606,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);
|
||||
}
|
||||
|
||||
@@ -645,6 +652,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.valueOf((Integer) 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()))
|
||||
@@ -660,6 +720,23 @@ 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());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateReport(SpdmReportReq req, HttpServletResponse response) {
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<if test="req.todayTmrTasks != null and req.todayTmrTasks != ''">
|
||||
<![CDATA[
|
||||
and STR_TO_DATE(end_time,'%Y-%m-%d') >= CURRENT_DATE()
|
||||
and STR_TO_DATE(end_time,'%Y-%m-%d') <= DATE_ADD(CURRENT_DATE(), INTERVAL 2 DAY) ;
|
||||
and STR_TO_DATE(end_time,'%Y-%m-%d') <= DATE_ADD(CURRENT_DATE(), INTERVAL 2 DAY)
|
||||
]]>
|
||||
</if>
|
||||
<if test="req.finishTime != null and req.finishTime != ''">
|
||||
|
||||
Reference in New Issue
Block a user