From a19d26e88360c9760b2286bac4dfb1710fd2fa21 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期六, 12 八月 2023 13:33:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java
index 4a1ea85..63e35bb 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/VCIFlowserviceImpl.java
@@ -19,14 +19,17 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.vci.ubcs.flow.core.constant.ProcessConstant;
 import com.vci.ubcs.flow.core.dto.FlowTaskDTO;
+import com.vci.ubcs.flow.core.dto.ProcessStageAttrDTO;
 import com.vci.ubcs.flow.core.entity.BladeFlow;
 import com.vci.ubcs.flow.core.entity.FlowTaskUser;
+import com.vci.ubcs.flow.core.entity.ProcessStageAttr;
 import com.vci.ubcs.flow.core.utils.TaskUtil;
 import com.vci.ubcs.flow.engine.entity.*;
 import com.vci.ubcs.flow.engine.service.FlowEngineService;
 import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
 import com.vci.ubcs.flow.engine.service.ProcessStageAttrService;
 import com.vci.ubcs.flow.engine.service.VICFlowService;
+import com.vci.ubcs.starter.web.util.BeanUtil;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -156,10 +159,17 @@
 
 		String modelKey = processInstance.getProcessDefinitionKey();
 		List<FlowTaskDTO> mis = flowEngineService.getNodeByFlowableKey(modelKey);
+		Map<String,String> taskMap = new HashMap<>();
+		mis.stream().forEach(e->{
+			String taskId = e.getTaskId();
+			String taskName = e.getTaskName();
+			taskMap.put(taskId,taskName);
+		});
 
 		// 杈撳嚭杩炵嚎
 		List<SequenceFlow> outFlows = flowNode.getOutgoingFlows();
 		for (SequenceFlow sequenceFlow : outFlows) {
+			String toname = sequenceFlow.getName()==null?"鍚屾剰":sequenceFlow.getName();
 			//褰撳墠瀹℃壒鑺傜偣
 			if (NODE_NOW.equals(node)) {
 				FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();
@@ -171,9 +181,11 @@
 					FlowTaskDTO flowTaskUserCi = new FlowTaskDTO();
 					//flowTaskUserCi.setConditionKey(null);
 					//flowTaskUserCi.setConditionValue(null);
-					flowTaskUserCi.setToName("鍚屾剰");
+					flowTaskUserCi.setToName(toname);
 					flowTaskUserCi.setToTaskId(targetFlow.getId());
-					flowTaskUserCi.setToTaskName(targetFlow.getName());
+					String taskName = taskMap.get(targetFlow.getId());
+					flowTaskUserCi.setToTaskName(taskName);
+					flowTaskUserCi.setTaskName(taskName);
 					taskList.add(flowTaskUserCi);
 				}
 
@@ -196,6 +208,7 @@
 						String conditionExpression = nexti.getConditionExpression();//condition
 						String taskId = nexti.getTargetRef();//taskId
 						String name = nexti.getName();//toName,椹冲洖銆佸悓鎰�
+						String taskName = taskMap.get(targetFlow.getId());
 
 						for (FlowTaskDTO flowTaskUserCi:mis){
 							if(taskId.equals(flowTaskUserCi.getTaskId())){
@@ -217,7 +230,8 @@
 								}
 								flowTaskUserCi.setToName(name);
 								flowTaskUserCi.setToTaskId(taskId);
-								flowTaskUserCi.setToTaskName(flowTaskUserCi.getTaskName());
+								flowTaskUserCi.setToTaskName(taskName);
+								flowTaskUserCi.setTaskName(taskName);
 								taskList.add(flowTaskUserCi);
 							}
 						}
@@ -232,6 +246,22 @@
 			flowTaskDTO.setVariables(variables);
 		}
 
+		//娴佺▼闃舵
+		Map<String, Object> m = new HashMap<>();
+		String templateId = variables.get("templateId").toString();
+		m.put("template_id", templateId);
+		m.put("task_id", crruentActivityId);
+		m.put("model_key", modelKey);
+		QueryWrapper q = Condition.getQueryWrapper(m, ProcessStageAttr.class)
+			.select("attr_id attrId,attr_name attrName,attr_group attrGroup");
+		List<ProcessStageAttr> stageAttrs = processStageAttrService.list(q);
+		List<ProcessStageAttrDTO> stageAttrsDto = new ArrayList<>();
+		stageAttrs.stream().forEach(e->{
+			ProcessStageAttrDTO dto = new ProcessStageAttrDTO();
+			BeanUtil.convert(e,dto);
+			stageAttrsDto.add(dto);
+		});
+		flowTaskDTO.setStageAttrs(stageAttrsDto);
 
 		//鏀惧叆娴佺▼闃舵銆佹祦绋媘odelkey
 		variables.put(TASKID,crruentActivityId);

--
Gitblit v1.9.3