From 42085aad206257ddeffe71d6defc547b5e13b4b7 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 26 六月 2023 19:57:50 +0800
Subject: [PATCH] 代码整合

---
 Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
index 46130f0..4e70d5f 100644
--- a/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
+++ b/Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
@@ -27,12 +27,17 @@
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.StringUtils;
 import org.flowable.engine.HistoryService;
+import org.flowable.engine.RuntimeService;
 import org.flowable.engine.TaskService;
 import org.flowable.engine.history.HistoricProcessInstance;
 import org.flowable.engine.history.HistoricProcessInstanceQuery;
+import org.flowable.engine.runtime.Execution;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.flowable.task.api.Task;
 import org.flowable.task.api.TaskQuery;
 import org.flowable.task.api.history.HistoricTaskInstance;
 import org.flowable.task.api.history.HistoricTaskInstanceQuery;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.Func;
@@ -55,6 +60,7 @@
 
 	private final TaskService taskService;
 	private final HistoryService historyService;
+	private final RuntimeService runtimeService;
 
 	@Override
 	public IPage<BladeFlow> selectClaimPage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
@@ -264,8 +270,22 @@
 			variables = Kv.create();
 		}
 		variables.put(ProcessConstant.PASS_KEY, flow.isPass());
+
 		// 瀹屾垚浠诲姟
 		taskService.complete(taskId, variables);
+
+//		//璁剧疆涓嬩竴姝ュ鏍镐汉
+//		Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult();//涓嬩竴姝ヨ妭鐐�
+//		String taskKey = task.getTaskDefinitionKey();//灏辨槸娴佺▼閰嶇疆鐨勮妭鐐筰d
+//		Object to = getVar(processInstanceId,taskKey);
+//		if(to==null){
+//			throw new ServiceException(taskKey+"娌℃湁璁剧疆瀹℃牳浜�");
+//		}
+//		String assignee = to.toString();
+//
+//		if(StringUtils.isNotEmpty(assignee)) {
+//			task.setAssignee(assignee);
+//		}
 		return true;
 	}
 
@@ -332,4 +352,16 @@
 		return historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
 	}
 
+	public Object getVar(String processInstanceId,String key){
+		Object t = null;
+		List<Execution> list = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).list();
+		for (Execution execution : list) {
+			Object va = runtimeService.getVariable(execution.getId(),key);
+			if(va!=null){
+				t=va;
+			}
+		}
+		return t;
+	}
+
 }

--
Gitblit v1.9.3