|
|
|
@ -432,8 +432,57 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UserTask getNextTasks(Task task){
|
|
|
|
|
|
|
|
|
|
//获取流程发布Id信息
|
|
|
|
|
String definitionId = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getProcessDefinitionId();
|
|
|
|
|
|
|
|
|
|
//获取bpm对象
|
|
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(definitionId);
|
|
|
|
|
|
|
|
|
|
//传节点定义key 获取当前节点
|
|
|
|
|
FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey());
|
|
|
|
|
|
|
|
|
|
//输出连线
|
|
|
|
|
List<SequenceFlow> outgoingFlows = flowNode.getOutgoingFlows();
|
|
|
|
|
|
|
|
|
|
//遍历返回下一个节点信息
|
|
|
|
|
for (SequenceFlow outgoingFlow : outgoingFlows) {
|
|
|
|
|
//类型自己判断
|
|
|
|
|
FlowElement targetFlowElement = outgoingFlow.getTargetFlowElement();
|
|
|
|
|
//用户任务
|
|
|
|
|
if (targetFlowElement instanceof UserTask) {
|
|
|
|
|
UserTask userTask = (UserTask) targetFlowElement;
|
|
|
|
|
return userTask;
|
|
|
|
|
} else if (targetFlowElement instanceof ExclusiveGateway) {
|
|
|
|
|
setExclusiveGateway(targetFlowElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setExclusiveGateway(FlowElement targetFlow) {
|
|
|
|
|
//排他网关,获取连线信息
|
|
|
|
|
List<SequenceFlow> targetFlows = ((ExclusiveGateway) targetFlow).getOutgoingFlows();
|
|
|
|
|
for (SequenceFlow sequenceFlow : targetFlows) {
|
|
|
|
|
//目标节点信息
|
|
|
|
|
FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement();
|
|
|
|
|
if (targetFlowElement instanceof UserTask) {
|
|
|
|
|
// do something
|
|
|
|
|
} else if (targetFlowElement instanceof EndEvent) {
|
|
|
|
|
// do something
|
|
|
|
|
} else if (targetFlowElement instanceof ServiceTask) {
|
|
|
|
|
// do something
|
|
|
|
|
} else if (targetFlowElement instanceof ExclusiveGateway) {
|
|
|
|
|
//递归寻找
|
|
|
|
|
setExclusiveGateway(targetFlowElement);
|
|
|
|
|
} else if (targetFlowElement instanceof SubProcess) {
|
|
|
|
|
// do something
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 完成任务
|
|
|
|
|
*/
|
|
|
|
@ -481,6 +530,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
*/
|
|
|
|
|
private void disposeSucceedTask(Task task, ProcessDefinition processDefinition, Map<String, Object> variables,
|
|
|
|
|
OcrTaskchildPicture model, String formId, UserToken userToken, FlowApprove approve, String deptid) throws Exception {
|
|
|
|
|
|
|
|
|
|
//获取下一个节点
|
|
|
|
|
UserTask userTask = this.getNextTasks(task);
|
|
|
|
|
if(null != userTask){
|
|
|
|
|
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
|
|
|
|
|
// 会签节点
|
|
|
|
|
if (Objects.nonNull(multiInstance)) {
|
|
|
|
|
if(null != userTask.getCandidateUsers() && userTask.getCandidateUsers().size() > 1){
|
|
|
|
|
variables.put("persons",userTask.getCandidateUsers());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//进入下一个节点
|
|
|
|
|
taskService.complete(task.getId(), variables);
|
|
|
|
|
updateAssignee(task.getProcessInstanceId(), task.getProcessDefinitionId(), processDefinition, deptid);
|
|
|
|
|