提交 9825bc5e 编写于 作者: zhouweidong's avatar zhouweidong

工作流加签

上级 61c03636
...@@ -16,7 +16,6 @@ import cn.ibizlab.util.service.RemoteService; ...@@ -16,7 +16,6 @@ import cn.ibizlab.util.service.RemoteService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils;
import org.flowable.bpmn.BpmnAutoLayout; import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.converter.BpmnXMLConverter; import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.*; import org.flowable.bpmn.model.*;
...@@ -26,10 +25,7 @@ import org.flowable.common.engine.api.identity.AuthenticationContext; ...@@ -26,10 +25,7 @@ import org.flowable.common.engine.api.identity.AuthenticationContext;
import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.common.engine.impl.identity.UserIdAuthenticationContext; import org.flowable.common.engine.impl.identity.UserIdAuthenticationContext;
import org.flowable.editor.language.json.converter.BpmnJsonConverter; import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.HistoryService; import org.flowable.engine.*;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.history.HistoricProcessInstance;
...@@ -99,6 +95,9 @@ public class WFCoreService ...@@ -99,6 +95,9 @@ public class WFCoreService
@Autowired @Autowired
private RuntimeService runtimeService; private RuntimeService runtimeService;
@Autowired
protected ManagementService managementService;
@Autowired @Autowired
private WFModelService wfModelService; private WFModelService wfModelService;
...@@ -610,14 +609,26 @@ public class WFCoreService ...@@ -610,14 +609,26 @@ public class WFCoreService
transientVariables.put("activedata",activedata); transientVariables.put("activedata",activedata);
//transientVariables.put("curuser",getCurUser()); //transientVariables.put("curuser",getCurUser());
//根据流程定义启动流程 //根据流程定义启动流程
Authentication.setAuthenticatedUserId(userId); Authentication.setAuthenticatedUserId(userId);
Authentication.setAuthenticationContext(createAuthenticationContext()); Authentication.setAuthenticationContext(createAuthenticationContext());
taskService.complete(taskId, variables,transientVariables); Task curTask = taskService.createTaskQuery().taskId(taskId).singleResult();
WFProcessInstance instance = new WFProcessInstance(); taskService.complete(taskId, variables,transientVariables);
instance.setBusinesskey(processInstanceBusinessKey); WFProcessInstance instance = new WFProcessInstance();
instance.setBusinesskey(processInstanceBusinessKey);
//加签处理
if (curTask != null && DelegationState.PENDING != curTask.getDelegationState() && !StringUtils.isEmpty(curTask.getParentTaskId())) {
String tableName = managementService.getTableName(TaskEntity.class);
String sql = "select count(1) from " + tableName + " where PARENT_TASK_ID_=#{parentTaskId}";
long subTaskCount = taskService.createNativeTaskQuery().sql(sql).parameter("parentTaskId", curTask.getParentTaskId()).count();
//完成加签任务,激活主任务
if (subTaskCount == 0) {
taskService.resolveTask(curTask.getParentTaskId());
log.info("加签任务结束,激活主任务[{}]", curTask.getParentTaskId());
}
}
return instance; return instance;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册