From 264a44181d3a3a4b725de9354d79d171c99cecde Mon Sep 17 00:00:00 2001 From: SunpengWan <825559776@qq.com> Date: Fri, 20 Sep 2024 15:15:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8A=82=E7=82=B9=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E6=9B=B4=E6=94=B9flowId=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/dao/impl/NodeContentMapper.xml | 1 + .../dss/workflow/entity/DSSFlowNodeInfo.java | 11 ++++ .../service/impl/DSSFlowServiceImpl.java | 51 +++---------------- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/dao/impl/NodeContentMapper.xml b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/dao/impl/NodeContentMapper.xml index 397679d56..f8c7520fb 100644 --- a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/dao/impl/NodeContentMapper.xml +++ b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/dao/impl/NodeContentMapper.xml @@ -131,6 +131,7 @@ ,t1.modify_time as modifyTime ,t1.create_time as createTime ,t1.node_key as nodeKey + ,t1.flow_id as flowId from dss_workflow_node_content t1 join (select * from dss_orchestrator_info where project_id in diff --git a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/entity/DSSFlowNodeInfo.java b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/entity/DSSFlowNodeInfo.java index 134f904dd..67ebeb84f 100644 --- a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/entity/DSSFlowNodeInfo.java +++ b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/entity/DSSFlowNodeInfo.java @@ -24,6 +24,8 @@ public class DSSFlowNodeInfo { private Date createTime; + private Long flowId; + public String getNodeId() { return nodeId; @@ -108,4 +110,13 @@ public String getNodeKey() { public void setNodeKey(String nodeKey) { this.nodeKey = nodeKey; } + + + public Long getFlowId() { + return flowId; + } + + public void setFlowId(Long flowId) { + this.flowId = flowId; + } } diff --git a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/service/impl/DSSFlowServiceImpl.java b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/service/impl/DSSFlowServiceImpl.java index 8e61729eb..a878e964a 100644 --- a/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/service/impl/DSSFlowServiceImpl.java +++ b/dss-orchestrator/orchestrators/dss-workflow/dss-workflow-server/src/main/java/com/webank/wedatasphere/dss/workflow/service/impl/DSSFlowServiceImpl.java @@ -1162,12 +1162,7 @@ public DataDevelopNodeResponse queryDataDevelopNodeList(String username, Workspa return dataDevelopNodeResponse; } - Map flowMap = getFlowMap(flowNodeInfoList); - if(flowMap.isEmpty()){ - logger.error("queryDataDevelopNodeList not find dssFlow info"); - return dataDevelopNodeResponse; - } // 查询模板信息 // List orchestratorIdList = flowNodeInfoList.stream().map(DSSFlowNodeInfo::getOrchestratorId).collect(Collectors.toList()); @@ -1182,7 +1177,6 @@ public DataDevelopNodeResponse queryDataDevelopNodeList(String username, Workspa DSSFlowNodeInfo dssFlowNodeInfo = dssFlowNodeInfoMap.get(contentId); List nodeUIList = nodeContentUIGroup.get(contentId); DSSProject dssProject = dssProjectMap.get(dssFlowNodeInfo.getProjectId()); - DSSFlow dssFlow = flowMap.getOrDefault(dssFlowNodeInfo.getOrchestratorId(),new DSSFlow()); // Map nodeDefaultValue = getNodeDefaultValue(nodeInfoGroup, dssFlowNodeInfo.getJobType()); @@ -1190,7 +1184,7 @@ public DataDevelopNodeResponse queryDataDevelopNodeList(String username, Workspa List nodeUIValues = nodeUIList.stream().map(NodeContentUIDO::getNodeUIValue).collect(Collectors.toList()); Map nodeMap = CollUtil.zip(nodeUIKeys, nodeUIValues); - NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username,dssFlow); + NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username); BeanUtils.copyProperties(nodeBaseInfo, dataDevelopNodeInfo); dataDevelopNodeInfo.setResource(nodeMap.get("resources")); @@ -1321,13 +1315,6 @@ public DataViewNodeResponse queryDataViewNode(String username, Workspace workspa return dataViewNodeResponse; } - Map flowMap = getFlowMap(flowNodeInfoList); - - if(flowMap.isEmpty()){ - logger.error("queryDataViewNode not find dssFlow info"); - return dataViewNodeResponse; - } - List dataViewNodeInfoList = new ArrayList<>(); for (Long contentId : nodeContentUIGroup.keySet()) { @@ -1336,13 +1323,12 @@ public DataViewNodeResponse queryDataViewNode(String username, Workspace workspa DSSFlowNodeInfo dssFlowNodeInfo = dssFlowNodeInfoMap.get(contentId); List nodeUIList = nodeContentUIGroup.get(contentId); DSSProject dssProject = dssProjectMap.get(dssFlowNodeInfo.getProjectId()); - DSSFlow dssFlow = flowMap.getOrDefault(dssFlowNodeInfo.getOrchestratorId(),new DSSFlow()); List nodeUIKeys = nodeUIList.stream().map(NodeContentUIDO::getNodeUIKey).collect(Collectors.toList()); List nodeUIValues = nodeUIList.stream().map(NodeContentUIDO::getNodeUIValue).collect(Collectors.toList()); Map nodeMap = CollUtil.zip(nodeUIKeys, nodeUIValues); - NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username,dssFlow); + NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username); BeanUtils.copyProperties(nodeBaseInfo, dataViewNodeInfo); dataViewNodeInfo.setNodeDesc(nodeMap.get("desc")); @@ -1829,13 +1815,6 @@ public DataCheckerNodeResponse queryDataCheckerNode(String username, Workspace w return dataCheckerNodeResponse; } - Map flowMap = getFlowMap(flowNodeInfoList); - - if(flowMap.isEmpty()){ - logger.error("queryDataCheckerNode not find dssFlow info"); - return dataCheckerNodeResponse; - } - List dataCheckerNodeInfoList = new ArrayList<>(); @@ -1846,7 +1825,6 @@ public DataCheckerNodeResponse queryDataCheckerNode(String username, Workspace w DSSFlowNodeInfo dssFlowNodeInfo = dssFlowNodeInfoMap.get(contentId); List nodeUIList = nodeContentUIGroup.get(contentId); DSSProject dssProject = dssProjectMap.get(dssFlowNodeInfo.getProjectId()); - DSSFlow dssFlow = flowMap.getOrDefault(dssFlowNodeInfo.getOrchestratorId(),new DSSFlow()); // Map nodeDefaultValue = getNodeDefaultValue(nodeInfoGroup, dssFlowNodeInfo.getJobType()); @@ -1854,7 +1832,7 @@ public DataCheckerNodeResponse queryDataCheckerNode(String username, Workspace w List nodeUIValues = nodeUIList.stream().map(NodeContentUIDO::getNodeUIValue).collect(Collectors.toList()); Map nodeMap = CollUtil.zip(nodeUIKeys, nodeUIValues); - NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username,dssFlow); + NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username); BeanUtils.copyProperties(nodeBaseInfo, dataCheckerNodeInfo); dataCheckerNodeInfo.setMaxCheckHours(nodeMap.get("max.check.hours")); @@ -1982,12 +1960,6 @@ public EventSenderNodeResponse queryEventSenderNode(String username, Workspace w return eventSenderNodeResponse; } - Map flowMap = getFlowMap(flowNodeInfoList); - - if(flowMap.isEmpty()){ - logger.error("queryEventSenderNode not find dssFlow info"); - return eventSenderNodeResponse; - } List eventSenderNodeInfoList = new ArrayList<>(); @@ -1998,13 +1970,12 @@ public EventSenderNodeResponse queryEventSenderNode(String username, Workspace w DSSFlowNodeInfo dssFlowNodeInfo = dssFlowNodeInfoMap.get(contentId); List nodeUIList = nodeContentUIGroup.get(contentId); DSSProject dssProject = dssProjectMap.get(dssFlowNodeInfo.getProjectId()); - DSSFlow dssFlow = flowMap.getOrDefault(dssFlowNodeInfo.getOrchestratorId(),new DSSFlow()); List nodeUIKeys = nodeUIList.stream().map(NodeContentUIDO::getNodeUIKey).collect(Collectors.toList()); List nodeUIValues = nodeUIList.stream().map(NodeContentUIDO::getNodeUIValue).collect(Collectors.toList()); Map nodeMap = CollUtil.zip(nodeUIKeys, nodeUIValues); - NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username,dssFlow); + NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username); BeanUtils.copyProperties(nodeBaseInfo, eventSenderNodeInfo); eventSenderNodeInfo.setNodeDesc(nodeMap.get("desc")); eventSenderNodeInfo.setMsgType(nodeMap.get("msg.type")); @@ -2128,13 +2099,6 @@ public EventReceiveNodeResponse queryEventReceiveNode(String username, Workspace return eventReceiveNodeResponse; } - Map flowMap = getFlowMap(flowNodeInfoList); - - if(flowMap.isEmpty()){ - logger.error("queryEventSenderNode not find dssFlow info"); - return eventReceiveNodeResponse; - } - List eventReceiverNodeInfoList = new ArrayList<>(); @@ -2145,14 +2109,13 @@ public EventReceiveNodeResponse queryEventReceiveNode(String username, Workspace DSSFlowNodeInfo dssFlowNodeInfo = dssFlowNodeInfoMap.get(contentId); List nodeUIList = nodeContentUIGroup.get(contentId); DSSProject dssProject = dssProjectMap.get(dssFlowNodeInfo.getProjectId()); - DSSFlow dssFlow = flowMap.getOrDefault(dssFlowNodeInfo.getOrchestratorId(),new DSSFlow()); // Map nodeDefaultValue = getNodeDefaultValue(nodeInfoGroup, dssFlowNodeInfo.getJobType()); List nodeUIKeys = nodeUIList.stream().map(NodeContentUIDO::getNodeUIKey).collect(Collectors.toList()); List nodeUIValues = nodeUIList.stream().map(NodeContentUIDO::getNodeUIValue).collect(Collectors.toList()); Map nodeMap = CollUtil.zip(nodeUIKeys, nodeUIValues); - NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username,dssFlow); + NodeBaseInfo nodeBaseInfo = getNodeBaseInfo(dssFlowNodeInfo, dssProject, nodeMap,username); BeanUtils.copyProperties(nodeBaseInfo, eventReceiverNodeInfo); eventReceiverNodeInfo.setNodeDesc(nodeMap.get("desc")); eventReceiverNodeInfo.setMsgType(nodeMap.get("msg.type")); @@ -2358,7 +2321,7 @@ public Map getNodeDefaultValue(Map> nod - public NodeBaseInfo getNodeBaseInfo(DSSFlowNodeInfo dssFlowNodeInfo, DSSProject dssProject, Map nodeMap,String username,DSSFlow dssFlow) { + public NodeBaseInfo getNodeBaseInfo(DSSFlowNodeInfo dssFlowNodeInfo, DSSProject dssProject, Map nodeMap,String username) { NodeBaseInfo nodeBaseInfo = new NodeBaseInfo(); @@ -2380,7 +2343,7 @@ public NodeBaseInfo getNodeBaseInfo(DSSFlowNodeInfo dssFlowNodeInfo, DSSProject || (CollectionUtils.isNotEmpty(dssProject.getReleaseUsers()) && dssProject.getReleaseUsers().contains(username)) || (StringUtils.isNotEmpty(dssProject.getCreateBy()) && dssProject.getCreateBy().equals(username)); nodeBaseInfo.setEditable(editable); - nodeBaseInfo.setFlowId(dssFlow.getId()); + nodeBaseInfo.setFlowId(dssFlowNodeInfo.getFlowId()); return nodeBaseInfo;