提交 e1c15022 authored 作者: zhoushaopan's avatar zhoushaopan

设置流程发起人

上级 011e3b40
package com.tykj.workflowcore.workflow_editer.service.impl; package com.tykj.workflowcore.workflow_editer.service.impl;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo; import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowUser;
import com.tykj.workflowcore.workflow_editer.mapper.FlowsInfoMapper; import com.tykj.workflowcore.workflow_editer.mapper.FlowsInfoMapper;
import com.tykj.workflowcore.workflow_editer.service.NodePageService; import com.tykj.workflowcore.workflow_editer.service.NodePageService;
import com.tykj.workflowcore.workflow_editer.service.UserService;
import com.tykj.workflowcore.workflow_editer.service.WorkFlowService; import com.tykj.workflowcore.workflow_editer.service.WorkFlowService;
import com.tykj.workflowcore.workflow_editer.vo.*; import com.tykj.workflowcore.workflow_editer.vo.*;
import org.dom4j.Attribute; import org.dom4j.Attribute;
...@@ -10,6 +12,7 @@ import org.dom4j.Document; ...@@ -10,6 +12,7 @@ import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.HistoryService; import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService; import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
...@@ -48,7 +51,8 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -48,7 +51,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
private TaskService taskService; private TaskService taskService;
@Autowired @Autowired
private FlowsInfoMapper flowsInfoMapper; private FlowsInfoMapper flowsInfoMapper;
@Autowired
private UserService userService;
@Autowired @Autowired
private HistoryService historyService; private HistoryService historyService;
@Autowired @Autowired
...@@ -213,19 +217,10 @@ public class WorkFlowServiceImpl implements WorkFlowService { ...@@ -213,19 +217,10 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//获取变量池 //获取变量池
Map<String, Object> map = startFlowVo.getMap(); Map<String, Object> map = startFlowVo.getMap();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowKey, map); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowKey, map);
//设置流程发起人
WorkFlowUser currentUser = userService.getCurrentUser();
Task task =
taskService.createTaskQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult();
//获取当前人登录的id
// UserDetails userDetails = userService.getCurrentUserId();
// String username = userDetails.getUsername();
//通过用户名得到用户id
Long userId = 123L;
taskService.setAssignee(task.getId(),Long.toString(userId));
//调用业务服务接口 插入数据到记录表中 例如请假是插入请假表 //调用业务服务接口 插入数据到记录表中 例如请假是插入请假表
taskService.complete(task.getId()); Authentication.setAuthenticatedUserId(currentUser.getId()+"");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论