|
@@ -140,7 +140,7 @@ public class ComTaskServiceImpl implements ComTaskService{
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void completeTaskByProcInstId(String procInstId,Map<String, Object> variables) throws Exception{
|
|
|
|
|
|
+ public void completeTaskByProcInstIdAndAssignee(String procInstId,Map<String, Object> variables) throws Exception{
|
|
String assignee = variables.get("assignee")+"";
|
|
String assignee = variables.get("assignee")+"";
|
|
if(StringUtils.isNotBlank(assignee)){
|
|
if(StringUtils.isNotBlank(assignee)){
|
|
Task task = taskService.createTaskQuery()
|
|
Task task = taskService.createTaskQuery()
|
|
@@ -258,5 +258,36 @@ public class ComTaskServiceImpl implements ComTaskService{
|
|
private String getGatewayCondition(String gatewayId, String processInstanceId) {
|
|
private String getGatewayCondition(String gatewayId, String processInstanceId) {
|
|
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).singleResult();
|
|
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).singleResult();
|
|
return runtimeService.getVariable(execution.getId(), gatewayId)+"";
|
|
return runtimeService.getVariable(execution.getId(), gatewayId)+"";
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Task findTaskByProcInstIdAndAssignee(String procInstId,String assignee) {
|
|
|
|
+ Task task = null;
|
|
|
|
+ if(StringUtils.isNotBlank(procInstId)&&StringUtils.isNotBlank(assignee)){
|
|
|
|
+ task = taskService.createTaskQuery()
|
|
|
|
+ .processInstanceId(procInstId)
|
|
|
|
+ .taskAssignee(assignee)
|
|
|
|
+ .active()
|
|
|
|
+ .singleResult();
|
|
|
|
+ }
|
|
|
|
+ return task;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void completeTaskByProcInstIdAndRole(String procInstId,Map<String, Object> variables) throws Exception {
|
|
|
|
+ String role = variables.get("role")+"";
|
|
|
|
+ String assignee = variables.get("assignee")+"";
|
|
|
|
+ if(StringUtils.isNotBlank(role)){
|
|
|
|
+ Task task = taskService.createTaskQuery()
|
|
|
|
+ .processInstanceId(procInstId)
|
|
|
|
+ .taskCandidateGroup(role)
|
|
|
|
+ .active()
|
|
|
|
+ .singleResult();
|
|
|
|
+ // 让指定userId的用户认领指定taskId的任务
|
|
|
|
+ taskService.claim(task.getId(), assignee);
|
|
|
|
+ if (task!=null) {
|
|
|
|
+ taskService.complete(task.getId(), variables);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|