修复activiti子流程节点监听失败问题
This commit is contained in:
parent
8a0661af9e
commit
1d5ca2417b
|
@ -37,11 +37,10 @@ import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
|||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.identity.Group;
|
||||
import org.activiti.engine.identity.User;
|
||||
import org.activiti.engine.impl.RepositoryServiceImpl;
|
||||
import org.activiti.engine.impl.persistence.entity.GroupEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.UserEntity;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
|
@ -74,28 +73,31 @@ import java.util.Map;
|
|||
public class ActivitiController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
RepositoryService repositoryService;
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
ObjectMapper objectMapper;
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
RuntimeService runtimeService;
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
IdentityService identityService;
|
||||
private IdentityService identityService;
|
||||
|
||||
@Autowired
|
||||
SysUserService userService;
|
||||
private SysUserService userService;
|
||||
|
||||
@Autowired
|
||||
RoleService roleService;
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
RoleUserService roleUserService;
|
||||
private RoleUserService roleUserService;
|
||||
|
||||
@Autowired
|
||||
ActAssigneeService actAssigneeService;
|
||||
private ActAssigneeService actAssigneeService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -288,14 +290,6 @@ public class ActivitiController extends BaseController {
|
|||
return j;
|
||||
}
|
||||
|
||||
public List<ActivityImpl> getActivityList(String deploymentId) {
|
||||
org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService
|
||||
.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
|
||||
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
|
||||
.getDeployedProcessDefinition(processDefinition.getId());
|
||||
return processDefinitionEntity.getActivities();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程部署id获取节点并且传到前端
|
||||
|
@ -304,16 +298,13 @@ public class ActivitiController extends BaseController {
|
|||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("goAssignee/{id}")
|
||||
public String goAssignee(@PathVariable("id") String deploymentId,
|
||||
@GetMapping("goAssignee/{deploymentId}")
|
||||
public String goAssignee(@PathVariable("deploymentId") String deploymentId,
|
||||
org.springframework.ui.Model model) {
|
||||
|
||||
/**根据流程实例id查询出所有流程节点*/
|
||||
List<ActivityImpl> activityList = getActivityList(deploymentId);
|
||||
|
||||
List<ActivityImpl> activityList = actAssigneeService.getActivityList(deploymentId);
|
||||
/**角色和节点关系封装成list*/
|
||||
List<SysRole> roleList = roleService.selectListByPage(new SysRole());
|
||||
List<Checkbox> checkboxes = new ArrayList<>();
|
||||
Checkbox checkbox = null;
|
||||
Map<String, Object> map = null;
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
|
@ -399,7 +390,7 @@ public class ActivitiController extends BaseController {
|
|||
public JsonUtil delDeploy(org.springframework.ui.Model model, String id) {
|
||||
JsonUtil j = new JsonUtil();
|
||||
try {
|
||||
List<ActivityImpl> activityList = getActivityList(id);
|
||||
List<ActivityImpl> activityList = actAssigneeService.getActivityList(id);
|
||||
for (ActivityImpl activity : activityList) {
|
||||
String nodeId = activity.getId();
|
||||
if (StringUtils.isEmpty(nodeId) || "start".equals(nodeId) || "end".equals(nodeId)) {
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.len.service;
|
|||
|
||||
import com.len.base.BaseService;
|
||||
import com.len.entity.ActAssignee;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
|
@ -11,4 +14,8 @@ import com.len.entity.ActAssignee;
|
|||
public interface ActAssigneeService extends BaseService<ActAssignee,String> {
|
||||
int deleteByNodeId(String nodeId);
|
||||
|
||||
public List<ActivityImpl> getActivityList(String deploymentId);
|
||||
|
||||
public List<ActivityImpl> selectAllActivity(List<ActivityImpl> activities);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,28 +5,66 @@ import com.len.base.impl.BaseServiceImpl;
|
|||
import com.len.entity.ActAssignee;
|
||||
import com.len.mapper.ActAssigneeMapper;
|
||||
import com.len.service.ActAssigneeService;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.impl.RepositoryServiceImpl;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.impl.util.io.InputStreamSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/23.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Service
|
||||
public class ActAssigneeServiceImpl extends BaseServiceImpl<ActAssignee,String> implements
|
||||
ActAssigneeService{
|
||||
public class ActAssigneeServiceImpl extends BaseServiceImpl<ActAssignee, String> implements
|
||||
ActAssigneeService {
|
||||
|
||||
@Autowired
|
||||
ActAssigneeMapper actAssigneeMapper;
|
||||
@Autowired
|
||||
ActAssigneeMapper actAssigneeMapper;
|
||||
|
||||
@Override
|
||||
public BaseMapper<ActAssignee, String> getMappser() {
|
||||
return actAssigneeMapper;
|
||||
}
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Override
|
||||
public int deleteByNodeId(String nodeId) {
|
||||
return actAssigneeMapper.deleteByNodeId(nodeId);
|
||||
}
|
||||
@Override
|
||||
public BaseMapper<ActAssignee, String> getMappser() {
|
||||
return actAssigneeMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByNodeId(String nodeId) {
|
||||
return actAssigneeMapper.deleteByNodeId(nodeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivityImpl> getActivityList(String deploymentId) {
|
||||
org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService
|
||||
.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
|
||||
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
|
||||
.getDeployedProcessDefinition(processDefinition.getId());
|
||||
InputStream inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
|
||||
BpmnModel bm = new BpmnXMLConverter().convertToBpmnModel(new InputStreamSource(inputStream), false, true);
|
||||
return selectAllActivity(processDefinitionEntity.getActivities());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivityImpl> selectAllActivity(List<ActivityImpl> activities) {
|
||||
List<ActivityImpl> list = new ArrayList<>(activities);
|
||||
for (ActivityImpl activity : activities) {
|
||||
List<ActivityImpl> childActivities = activity.getActivities();
|
||||
if (!childActivities.isEmpty()) {
|
||||
list.addAll(selectAllActivity(childActivities));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
layer.msg('请选择一个流程', {icon: 5});
|
||||
return false;
|
||||
}
|
||||
assignee(data[0].deploymentId);
|
||||
assignee(data[0].id,data[0].deploymentId);
|
||||
}
|
||||
,reload:function(){
|
||||
$('#deploymentId').val('');
|
||||
|
@ -194,7 +194,7 @@
|
|||
* 流程绑定节点
|
||||
* @param id
|
||||
*/
|
||||
function assignee(id){
|
||||
function assignee(id,deploymentId){
|
||||
var index =
|
||||
layer.open({
|
||||
id: 'assignee',
|
||||
|
@ -205,7 +205,7 @@
|
|||
shadeClose: false,
|
||||
shade: 0.4,
|
||||
title: '设置流程节点',
|
||||
content: 'goAssignee/'+id
|
||||
content: 'goAssignee/'+deploymentId
|
||||
});
|
||||
layer.full(index);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue