提交 61c03636 编写于 作者: zhouweidong's avatar zhouweidong

还原处理连接角色逻辑

上级 b7b6645c
...@@ -509,79 +509,43 @@ public class WFCoreService ...@@ -509,79 +509,43 @@ public class WFCoreService
return instance; return instance;
} }
public List<WFTaskWay> getWFLink(String system,String appname, public List<WFTaskWay> getWFLink(String system,String appname,
String entity, String businessKey,String taskDefinitionKey) { String entity, String businessKey,String taskDefinitionKey) {
List<WFTaskWay> taskWays=new ArrayList<>(); List<WFTaskWay> taskWays=new ArrayList<>();
String processInstanceBusinessKey=system+":"+entity+":k-"+businessKey; String processInstanceBusinessKey=system+":"+entity+":k-"+businessKey;
String userId=AuthenticationUser.getAuthenticationUser().getUserid(); String userId=AuthenticationUser.getAuthenticationUser().getUserid();
if(StringUtils.isEmpty(userId)) if(StringUtils.isEmpty(userId))
return taskWays; return taskWays;
TaskQuery query=taskService.createTaskQuery().taskCandidateOrAssigned(userId).processInstanceBusinessKey(processInstanceBusinessKey); TaskQuery query=taskService.createTaskQuery().taskCandidateOrAssigned(userId).processInstanceBusinessKey(processInstanceBusinessKey);
if(!StringUtils.isEmpty(taskDefinitionKey)) if(!StringUtils.isEmpty(taskDefinitionKey))
query.taskDefinitionKey(taskDefinitionKey); query.taskDefinitionKey(taskDefinitionKey);
List<Task> list=query.orderByTaskCreateTime().desc().listPage(0,1); List<Task> list=query.orderByTaskCreateTime().desc().listPage(0,1);
if(list.size()==0) if(list.size()==0)
return taskWays; return taskWays;
Task task=list.get(0); Task task=list.get(0);
LinkedHashMap activeData = (LinkedHashMap)runtimeService.getVariable(task.getExecutionId(),"activedata"); if((!StringUtils.isEmpty(task.getProcessDefinitionId()))&&(!StringUtils.isEmpty(task.getTaskDefinitionKey()))) {
if((!StringUtils.isEmpty(task.getProcessDefinitionId()))&&(!StringUtils.isEmpty(task.getTaskDefinitionKey()))) { UserTask userTask = wfModelService.getModelStepById(task.getProcessDefinitionId()).get(task.getTaskDefinitionKey());
UserTask userTask = wfModelService.getModelStepById(task.getProcessDefinitionId()).get(task.getTaskDefinitionKey()); //设置流程表单
//设置流程表单 setProcessForm(userTask);
setProcessForm(userTask); if(userTask!=null&&userTask.getOutgoingFlows()!=null) {
if(userTask!=null&&userTask.getOutgoingFlows()!=null) { for(SequenceFlow sequenceFlow:userTask.getOutgoingFlows()) {
for(SequenceFlow sequenceFlow:userTask.getOutgoingFlows()) { WFTaskWay way=new WFTaskWay();
WFTaskWay way=new WFTaskWay(); way.setSequenceflowid(sequenceFlow.getId());
way.setSequenceflowid(sequenceFlow.getId()); way.setSequenceflowname(sequenceFlow.getName());
way.setSequenceflowname(sequenceFlow.getName()); if(task.getProcessDefinitionId().indexOf(":")>0)
if(task.getProcessDefinitionId().indexOf(":")>0) way.setProcessdefinitionkey(task.getProcessDefinitionId().split(":")[0]);
way.setProcessdefinitionkey(task.getProcessDefinitionId().split(":")[0]); way.setTaskid(task.getId());
way.setTaskid(task.getId()); way.setProcessinstanceid(task.getProcessInstanceId());
way.setProcessinstanceid(task.getProcessInstanceId()); way.setTaskdefinitionkey(task.getTaskDefinitionKey());
way.setTaskdefinitionkey(task.getTaskDefinitionKey()); way.setProcessinstancebusinesskey(processInstanceBusinessKey);
way.setProcessinstancebusinesskey(processInstanceBusinessKey); //设置流程交互表单
//设置流程交互表单 setTaskWayForm(sequenceFlow,way);
setTaskWayForm(sequenceFlow,way); taskWays.add(way);
String userIds = ""; }
String activeIds = ""; }
//过滤权限不足的用户 }
// String roles = (String) way.get("roles"); return taskWays;
// String activeForm = (String) way.get("activeData"); }
String roles = null;
String activeForm = null;
String[] both = new String[]{};
if(activeForm != null){
String[] temp = activeForm.split(",");
int iMax = temp.length - 1;
for(int i = 0;i < temp.length ;i++){
if (iMax == -1){
break;
}
Object key = activeData.get(temp[i]);
if(!ObjectUtils.isEmpty(key)) {
activeIds += key;
if (i == iMax) {
break;
}
activeIds += ",";
}
}
if(activeIds.endsWith(",")){
activeIds = activeIds.substring(0,activeIds.lastIndexOf(","));
}
}
both = (String[]) ArrayUtils.addAll(both, activeIds.split(","));
userIds = getGroupUsers(roles,null);
both = (String[]) ArrayUtils.addAll(both, userIds.split(","));
if(Arrays.asList(both).contains(userId) || (roles == null && activeForm == null)){
taskWays.add(way);
}
}
}
}
return taskWays;
}
public List<WFTaskWay> getTaskLink(String system,String appname, String entity, String businessKey,String taskId) { public List<WFTaskWay> getTaskLink(String system,String appname, String entity, String businessKey,String taskId) {
List<WFTaskWay> taskWays=new ArrayList<>(); List<WFTaskWay> taskWays=new ArrayList<>();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册