From 8ad298fe0062fe372034a902797138ac6048f7b7 Mon Sep 17 00:00:00 2001 From: gulongcheng <474084054@qq.com> Date: Tue, 13 Jan 2026 15:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=80=BB=E8=A7=88=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=A8=A1=E5=BC=8F=E5=B1=95=E7=A4=BA=E7=AE=97=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resp/data/FileMetadataInfoResp.java | 5 + .../resp/project/SimulationRunResp.java | 99 +++++++++++++++++++ .../SimulationNodeFeignClientImpl.java | 34 +++++-- .../project/ISimulationNodeFeignClient.java | 10 ++ .../model/dto/FileMetadataChildrenDTO.java | 1 + .../impl/DimensionTemplateServiceImpl.java | 31 +++++- .../controller/SimulationNodeController.java | 3 +- .../com/sdm/project/service/INodeService.java | 3 +- .../project/service/impl/NodeServiceImpl.java | 14 ++- 9 files changed, 186 insertions(+), 14 deletions(-) create mode 100644 common/src/main/java/com/sdm/common/entity/resp/project/SimulationRunResp.java diff --git a/common/src/main/java/com/sdm/common/entity/resp/data/FileMetadataInfoResp.java b/common/src/main/java/com/sdm/common/entity/resp/data/FileMetadataInfoResp.java index feb961d8..91f2d93e 100644 --- a/common/src/main/java/com/sdm/common/entity/resp/data/FileMetadataInfoResp.java +++ b/common/src/main/java/com/sdm/common/entity/resp/data/FileMetadataInfoResp.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.sdm.common.entity.resp.BaseResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -118,6 +119,10 @@ public class FileMetadataInfoResp extends BaseResp implements Serializable { @Schema(description = "权限值") private Integer permissionValue; + + @Schema(description = "算列信息") + private SimulationRunResp simulationRunResp; + private String approvalStatus; private String approveType; private String tempMetadata; diff --git a/common/src/main/java/com/sdm/common/entity/resp/project/SimulationRunResp.java b/common/src/main/java/com/sdm/common/entity/resp/project/SimulationRunResp.java new file mode 100644 index 00000000..83d5f6ce --- /dev/null +++ b/common/src/main/java/com/sdm/common/entity/resp/project/SimulationRunResp.java @@ -0,0 +1,99 @@ +package com.sdm.common.entity.resp.project; + +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 io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author author + * @since 2025-11-03 + */ +@Data +public class SimulationRunResp implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + private String uuid; + + private String runName; + + + private Integer type; + + private String taskId; + + @Schema(description= "流程模板id") + private String flowTemplate; + + @Schema(description= "Run状态 0:未执行 1:执行中 2:完成 3:失败") + private Integer status; + + @Schema(description= "Run总共的流程步骤") + private Integer totalStep; + + @Schema(description= "当前的流程步骤") + private Integer currentStep; + + @Schema(description= "当前的流程步骤名称") + private String currentStepName; + + @Schema(description= "Run执行结果 0:gray 1:red 2:yellow 3:green") + private Integer achieveStatus; + + @Schema(description= "run描述信息") + private String description; + + @Schema(description= "Run对应在文件系统中的路径") + private Long folderId; + + @Schema(description= "计算父版本Id") + private String parentId; + + private Integer isPersonalTemplate; + + @Schema(description= "租户id") + private Long tenantId; + + @Schema(description= "英文名") + private Long englishName; + + @Schema(description= "创建者ID") + private Long creator; + + @Schema(description= "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description= "更新者ID") + private Long updater; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "flowable流程完成部署后的流程定义id,根据这个发起流程实例") + public String processDefinitionId; + + @Schema(description= "流程实例id(流程引擎返回的)") + private String flowInstanceId; + + @Schema(description= "完成时间") + private LocalDateTime finishTime; + +} diff --git a/common/src/main/java/com/sdm/common/feign/impl/project/SimulationNodeFeignClientImpl.java b/common/src/main/java/com/sdm/common/feign/impl/project/SimulationNodeFeignClientImpl.java index 46665595..799a7294 100644 --- a/common/src/main/java/com/sdm/common/feign/impl/project/SimulationNodeFeignClientImpl.java +++ b/common/src/main/java/com/sdm/common/feign/impl/project/SimulationNodeFeignClientImpl.java @@ -3,9 +3,11 @@ package com.sdm.common.feign.impl.project; import com.sdm.common.common.SdmResponse; import com.sdm.common.entity.req.project.DelNodeReq; import com.sdm.common.entity.req.project.SpdmNodeListReq; +import com.sdm.common.entity.req.project.SpdmQueryRunInfoListReq; import com.sdm.common.entity.req.project.SpdmQueryRunListReq; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.project.SimulationNodeResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -17,7 +19,7 @@ import java.util.List; @Component public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient { @Autowired - ISimulationNodeFeignClient ISimulationNodeFeignClient; + ISimulationNodeFeignClient simulationNodeFeignClient; /** * 根据节点类型和节点ID获取所有节点信息 @@ -30,7 +32,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient SdmResponse> response; try { log.info("根据节点类型和节点ID获取所有节点信息请求参数:nodeId={}, nodeType={}", nodeId, nodeType); - response = ISimulationNodeFeignClient.getAllNodeByNodeType(nodeId, nodeType); + response = simulationNodeFeignClient.getAllNodeByNodeType(nodeId, nodeType); if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) { return SdmResponse.failed("获取节点信息失败"); } @@ -52,7 +54,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient SdmResponse> response; try { log.info("根据项目ID和节点类型获取所有节点信息请求参数:uuid={}, nextNodeType={}", uuids, nextNodeType); - response = ISimulationNodeFeignClient.getAllNodeByProjectIdAndType(uuids, nextNodeType); + response = simulationNodeFeignClient.getAllNodeByProjectIdAndType(uuids, nextNodeType); if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) { return SdmResponse.failed("获取节点信息失败"); } @@ -70,7 +72,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient SdmResponse> response; try { log.info("获取节点下的task列表请求参数:uuid={}", uuids); - response = ISimulationNodeFeignClient.getNodeTaskList(uuids); + response = simulationNodeFeignClient.getNodeTaskList(uuids); if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) { return SdmResponse.failed("获取节点下的task列表失败"); } @@ -86,7 +88,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient SdmResponse> response; try { log.info("获取task下的run请求参数:uuid={}", uuids); - response = ISimulationNodeFeignClient.getTaskRunList(uuids); + response = simulationNodeFeignClient.getTaskRunList(uuids); if (!response.isSuccess() || response.getData() == null || response.getData().isEmpty()) { return SdmResponse.failed("获取task下的run失败"); } @@ -103,7 +105,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient SdmResponse response; try { log.info("删除节点请求参数:{}", req); - response = ISimulationNodeFeignClient.delteNode(req); + response = simulationNodeFeignClient.delteNode(req); if (!response.isSuccess()) { return SdmResponse.failed("删除节点失败"); } @@ -118,7 +120,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient public SdmResponse list(SpdmNodeListReq req) { SdmResponse response; try { - response = ISimulationNodeFeignClient.list(req); + response = simulationNodeFeignClient.list(req); if (!response.isSuccess()) { return SdmResponse.failed("查询失败"); } @@ -133,7 +135,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient public SdmResponse> querySimulationNodeByUuids(List uuids) { SdmResponse response; try { - response = ISimulationNodeFeignClient.querySimulationNodeByUuids(uuids); + response = simulationNodeFeignClient.querySimulationNodeByUuids(uuids); if (!response.isSuccess()) { return SdmResponse.failed("查询失败"); } @@ -147,7 +149,7 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient @Override public SdmResponse> getRunListByNodeId(SpdmQueryRunListReq req) { try { - SdmResponse> runListByNodeId = ISimulationNodeFeignClient.getRunListByNodeId(req); + SdmResponse> runListByNodeId = simulationNodeFeignClient.getRunListByNodeId(req); if (!runListByNodeId.isSuccess()){ return SdmResponse.failed("查询失败"); } @@ -157,4 +159,18 @@ public class SimulationNodeFeignClientImpl implements ISimulationNodeFeignClient return SdmResponse.failed("查询失败"); } } + + @Override + public SdmResponse> getRunListByRunIdList(SpdmQueryRunInfoListReq req) { + try { + SdmResponse> runListByRunIdList = simulationNodeFeignClient.getRunListByRunIdList(req); + if (!runListByRunIdList.isSuccess()){ + return SdmResponse.failed("查询失败"); + } + return runListByRunIdList; + } catch (Exception e) { + log.error("查询失败", e); + return SdmResponse.failed("查询失败"); + } + } } diff --git a/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java b/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java index a25bb2d9..9f22df87 100644 --- a/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java +++ b/common/src/main/java/com/sdm/common/feign/inter/project/ISimulationNodeFeignClient.java @@ -3,9 +3,11 @@ package com.sdm.common.feign.inter.project; import com.sdm.common.common.SdmResponse; import com.sdm.common.entity.req.project.DelNodeReq; import com.sdm.common.entity.req.project.SpdmNodeListReq; +import com.sdm.common.entity.req.project.SpdmQueryRunInfoListReq; import com.sdm.common.entity.req.project.SpdmQueryRunListReq; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.project.SimulationNodeResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import io.swagger.v3.oas.annotations.Operation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.validation.annotation.Validated; @@ -69,5 +71,13 @@ public interface ISimulationNodeFeignClient { @PostMapping("/getRunListByNodeId") SdmResponse> getRunListByNodeId(@RequestBody SpdmQueryRunListReq req); + /** + * 根据算列id查询所有算例详情 + * + * @param req + * @return + */ + @PostMapping("/getRunListByRunIdList") + SdmResponse> getRunListByRunIdList(@RequestBody SpdmQueryRunInfoListReq req); } diff --git a/data/src/main/java/com/sdm/data/model/dto/FileMetadataChildrenDTO.java b/data/src/main/java/com/sdm/data/model/dto/FileMetadataChildrenDTO.java index 158e8a32..e37ceecf 100644 --- a/data/src/main/java/com/sdm/data/model/dto/FileMetadataChildrenDTO.java +++ b/data/src/main/java/com/sdm/data/model/dto/FileMetadataChildrenDTO.java @@ -1,6 +1,7 @@ package com.sdm.data.model.dto; import com.sdm.common.entity.resp.data.FileMetadataInfoResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java b/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java index e68992ab..617cccec 100644 --- a/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java +++ b/data/src/main/java/com/sdm/data/service/impl/DimensionTemplateServiceImpl.java @@ -13,11 +13,13 @@ import com.sdm.common.entity.req.data.DelDirReq; import com.sdm.common.entity.req.data.DelFileReq; import com.sdm.common.entity.req.data.UploadFilesReq; import com.sdm.common.entity.req.project.DelNodeReq; +import com.sdm.common.entity.req.project.SpdmQueryRunInfoListReq; import com.sdm.common.entity.req.project.SpdmQueryRunListReq; import com.sdm.common.entity.req.system.UserQueryReq; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.PageDataResp; import com.sdm.common.entity.resp.data.FileMetadataInfoResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import com.sdm.common.entity.resp.system.CIDUserResp; import com.sdm.common.feign.impl.project.SimulationNodeFeignClientImpl; import com.sdm.common.feign.impl.system.SysUserFeignClientImpl; @@ -426,7 +428,34 @@ public class DimensionTemplateServiceImpl extends ServiceImpl>> pageDataRespSdmResponse = processAndPageResults(runFileInfos, req); + // 设置算列信息 + dealRunInfo(pageDataRespSdmResponse); + + return pageDataRespSdmResponse; + } + + /** + * 查询并设置算列信息 + * @param pageDataRespSdmResponse + */ + private void dealRunInfo(SdmResponse>> pageDataRespSdmResponse) { + List runInfo = pageDataRespSdmResponse.getData().getData(); + List runUUids = runInfo.stream() + .flatMap(fileMetadataChildrenDTO -> fileMetadataChildrenDTO.getMergeSameNameChildren().stream()) + .map(FileMetadataInfoResp::getRelatedResourceUuid).toList(); + SpdmQueryRunInfoListReq spdmQueryRunInfoListReq = new SpdmQueryRunInfoListReq(); + spdmQueryRunInfoListReq.setRunIdList(runUUids); + SdmResponse> runListByRunIdList = simuluationNodeFeignClient.getRunListByRunIdList(spdmQueryRunInfoListReq); + if(runListByRunIdList.isSuccess()){ + Map runUUId2RunInfoMap = runListByRunIdList.getData().stream().collect(Collectors.toMap(SimulationRunResp::getUuid, t -> t)); + for (FileMetadataChildrenDTO fileMetadataChildrenDTO : runInfo) { + fileMetadataChildrenDTO.setSimulationRunResp(runUUId2RunInfoMap.get(fileMetadataChildrenDTO.getRelatedResourceUuid())); + for (FileMetadataInfoResp mergeSameNameChild : fileMetadataChildrenDTO.getMergeSameNameChildren()) { + mergeSameNameChild.setSimulationRunResp(runUUId2RunInfoMap.get(mergeSameNameChild.getRelatedResourceUuid())); + } + } + } } private SdmResponse>> handleRootDirectory(ListSimulationNodeTreeReq req, Long tenantId) { diff --git a/project/src/main/java/com/sdm/project/controller/SimulationNodeController.java b/project/src/main/java/com/sdm/project/controller/SimulationNodeController.java index 147448ef..fb11fd3e 100644 --- a/project/src/main/java/com/sdm/project/controller/SimulationNodeController.java +++ b/project/src/main/java/com/sdm/project/controller/SimulationNodeController.java @@ -6,6 +6,7 @@ import com.sdm.common.entity.req.data.UploadFilesReq; import com.sdm.common.entity.req.project.*; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.project.SimulationNodeResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient; import com.sdm.common.log.annotation.SysLog; import com.sdm.project.model.entity.SimulationRun; @@ -342,7 +343,7 @@ public class SimulationNodeController implements ISimulationNodeFeignClient { */ @PostMapping("/getRunListByRunIdList") @Operation(summary = "根据节点id查询所有算例", description = "根据节点id查询所有算例") - public SdmResponse> getRunListByRunIdList(@RequestBody @Validated SpdmQueryRunInfoListReq req) { + public SdmResponse> getRunListByRunIdList(@RequestBody @Validated SpdmQueryRunInfoListReq req) { return nodeService.getRunListByRunIdList(req); } diff --git a/project/src/main/java/com/sdm/project/service/INodeService.java b/project/src/main/java/com/sdm/project/service/INodeService.java index eb635159..0ef9bcca 100644 --- a/project/src/main/java/com/sdm/project/service/INodeService.java +++ b/project/src/main/java/com/sdm/project/service/INodeService.java @@ -6,6 +6,7 @@ import com.sdm.common.entity.req.data.UploadFilesReq; import com.sdm.common.entity.req.project.*; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.project.SimulationNodeResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import com.sdm.project.model.entity.SimulationNode; import com.sdm.project.model.entity.SimulationRun; import com.sdm.project.model.req.*; @@ -79,6 +80,6 @@ public interface INodeService extends IService { SdmResponse> getRunListByNodeId(SpdmQueryRunListReq req); - SdmResponse> getRunListByRunIdList(SpdmQueryRunInfoListReq req); + SdmResponse> getRunListByRunIdList(SpdmQueryRunInfoListReq req); } diff --git a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java index 3bedf4b6..03d94935 100644 --- a/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java +++ b/project/src/main/java/com/sdm/project/service/impl/NodeServiceImpl.java @@ -19,6 +19,7 @@ import com.sdm.common.entity.req.system.QueryGroupDetailReq; import com.sdm.common.entity.req.system.UserQueryReq; import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp; import com.sdm.common.entity.resp.project.SimulationNodeResp; +import com.sdm.common.entity.resp.project.SimulationRunResp; import com.sdm.common.entity.resp.system.CIDUserResp; import com.sdm.common.entity.resp.system.SysUserGroupDetailResp; import com.sdm.common.feign.impl.data.DataClientFeignClientImpl; @@ -2383,8 +2384,17 @@ public class NodeServiceImpl extends ServiceImpl> getRunListByRunIdList(SpdmQueryRunInfoListReq req) { - return SdmResponse.success(simulationRunService.lambdaQuery().in(SimulationRun::getUuid, req.getRunIdList()).list()); + public SdmResponse> getRunListByRunIdList(SpdmQueryRunInfoListReq req) { + List list = simulationRunService.lambdaQuery().in(SimulationRun::getUuid, req.getRunIdList()).list(); + if(CollectionUtils.isEmpty(list)) { + return SdmResponse.success(emptyList()); + } + List simulationRunResps = list.stream().map(simulationRun -> { + SimulationRunResp simulationRunResp = new SimulationRunResp(); + BeanUtils.copyProperties(simulationRun, simulationRunResp); + return simulationRunResp; + }).toList(); + return SdmResponse.success(simulationRunResps); } }