activiti版本5.22.0
主线退回分支需把结束的并行网关改为包容网关,否则退回后,无法打成并行网关批转的条件
测试流程图如下
增加了批转记录表 建表语句如下
create table ACT_ZZ_TASKPZRECORDS
(
ID NVARCHAR2(64) not null,
TASKID NVARCHAR2(64),
ACTID NVARCHAR2(64),
TOACTID NVARCHAR2(2000),
EXECUTIONID NVARCHAR2(64),
PARENTEXECUTIONID NVARCHAR2(64),
PARENTPARENTEXECUTIONID NVARCHAR2(64),
MULTIINSTANCETYPE NVARCHAR2(64),
FROMUSER NVARCHAR2(64),
TOUSERS CLOB,
PROCESSINSTID NVARCHAR2(64),
CREATEDATE DATE
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 8K
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table ACT_ZZ_TASKPZRECORDS
is '任务批转记录表';
-- Add comments to the columns
comment on column ACT_ZZ_TASKPZRECORDS.ID
is '主键';
comment on column ACT_ZZ_TASKPZRECORDS.TASKID
is '任务id';
comment on column ACT_ZZ_TASKPZRECORDS.ACTID
is '节点id';
comment on column ACT_ZZ_TASKPZRECORDS.TOACTID
is '批转到的节点id';
comment on column ACT_ZZ_TASKPZRECORDS.EXECUTIONID
is '执行id';
comment on column ACT_ZZ_TASKPZRECORDS.PARENTEXECUTIONID
is '父级执行id';
comment on column ACT_ZZ_TASKPZRECORDS.PARENTPARENTEXECUTIONID
is '父级执行id的父级执行id';
comment on column ACT_ZZ_TASKPZRECORDS.MULTIINSTANCETYPE
is 'parallel/sequential';
comment on column ACT_ZZ_TASKPZRECORDS.FROMUSER
is '从谁';
comment on column ACT_ZZ_TASKPZRECORDS.TOUSERS
is '到谁';
comment on column ACT_ZZ_TASKPZRECORDS.PROCESSINSTID
is '流程实例id';
comment on column ACT_ZZ_TASKPZRECORDS.CREATEDATE
is '创建时间';
-- Create/Recreate primary, unique and foreign key constraints
alter table ACT_ZZ_TASKPZRECORDS
add constraint ACT_ZZ_TASKPZRECORDS_ID primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
批转接口如下,调用批转前
需判断当前节点是不是多人任务,若是多人任务时,且不是最后一个人时,调用方法completetask,
若下个节点是结束节点时也调用completetask,当前节点的下个节点(可能多个,如并行网关时),其他调用方法completetaskForNext,
这是我们业务的处理,当然没有特殊需求的话都调用completetaskForNext也可以
/**
* 完成任务
* @param completeTaskVo
*/
@Transactional
@Override
public void completetaskForNext(CompleteTaskVo completeTaskVo) {
String taskId=completeTaskVo.getNowTaskId();
Task nowTask = taskService.createTaskQuery().taskId(taskId).active().singleResult();
if(nowTask==null){
throw new ZzpaasException("没有找到该活动任务,无法办理!");
}
if(StringUtils.isBlank(nowTask.getAssignee())){
throw new ZzpaasException("当前任务没有指定办理人,无法办理!");
}
//校验任务
//validateTask(nowTask, completeTaskVo.getReason());
String processInstanceId=completeTaskVo.getProcessInstanceId();
List<NextNodes> nextNodes=completeTaskVo.getNextNodes();
//添加批注
if(StringUtils.isBlank(completeTaskVo.getReason())){
completeTaskVo.setReason("批转");
}
addComment(taskId,processInstanceId,ProcessConstants.TASK_COMPLETE_FLAG, completeTaskVo.getReason());
//List<NextNodes> hxrList=new ArrayList<>();//下个节点是候选人任务的list
//Map<String,Object> variable=isDuorenAndSetVariable(nowTask);//需要设置的流程变量
Map<String,Object> variable=new HashMap<>();
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(nowTask.getProcessDefinitionId());
//判断当前任务节点出线终点是否是包容网关或者排他网关
ActivityImpl nowActivity = processDefinitionEntity.findActivity(nowTask.getTaskDefinitionKey());
List<PvmTransition> outgoingTransitions = nowActivity.getOutgoingTransitions();
boolean canRggy=false;//是否可以人工干预
String gateWayId="";
PvmActivity destination = outgoingTransitions.get(0).getDestination();
if("exclusiveGateway".equals(destination.getProperty("type"))||"inclusiveGateway".equals(destination.getProperty("type"))){
if("exclusiveGateway".equals(destination.getProperty("type"))&&nextNodes.size()>1){
throw new ZzpaasException("排他网关只能选择一个节点!");
}
List<PvmTransition> chuxians = destination.getOutgoingTransitions();//网管的所有出线
if(chuxians.size()>1){//如果只有一条出线 说明结束网关 只有开始网关才能人工干预
canRggy=true;
gateWayId=destination.getId();
}
}
//入线ids 人工干预时有用
List<String> inComingIds=new ArrayList<>();
for (NextNodes nextNode : nextNodes) {
if(canRggy){
//获取当前节点
ActivityImpl activity = processDefinitionEntity.findActivity(nextNode.getActivityId());
List<PvmTransition> incomingTransitions = activity.getIncomingTransitions();
inComingIds.add(incomingTransitions.get(0).getId());
}
//如果是个人任务 则判断办理人分配规则
String targetType = nextNode.getTargetType();
if(ProcessConstants.TARGET_TYPE_RYZD.equals(targetType)){//指定人员
variable.put(ProcessConstants.TARGET_ASSIGNEE_TYPE_RYZD_VARIABLES_KEY+nextNode.getActivityId(),nextNode.getTargets());
}else if(ProcessConstants.TARGET_TYPE_LCQDZ.equals(targetType)){//流程启动者
//由于流程启动者再流程启动时已设置 不需要再次设置
}else if(ProcessConstants.TARGET_TYPE_DUOREN_CHUANXING.equals(targetType)||
ProcessConstants.TARGET_TYPE_DUOREN_BINGXING.equals(targetType)){//下个节点是多人任务 串行或者并行
String targets = nextNode.getTargets();
String[] targetArr = targets.split(",");
//存入人员
variable.put(ProcessConstants.TARGET_ASSIGNEE_TYPE_DUOREN_LIST_KEY+nextNode.getActivityId(), Arrays.asList(targetArr));
}else if(ProcessConstants.TARGET_TYPE_HXR.equals(targetType)){//候选人模式 (抢办模式)
variable.put(ProcessConstants.TARGET_ASSIGNEE_TYPE_RYZD_VARIABLES_KEY+nextNode.getActivityId(),Arrays.asList(nextNode.getTargets().split(",")));
}else{//固定人员
//固定某人员 已在流程上指定 也不需要设置流程变量
}
}
if(canRggy){
//人工干预时有用
variable.put(ProcessConstants.RGGY_KEY+gateWayId,StringUtils.join(inComingIds,","));
}
//runtimeService.setVariables();
//批转之前插入批转记录
insetTaskPiZhuanRecords(nowTask,nowActivity,nextNodes);
//完成任务
taskService.complete(taskId,variable);
}
public void insetTaskPiZhuanRecords(Task nowTask,ActivityImpl nowActivity,List<NextNodes> nextNodes){
String taskid=nowTask.getId();
String actid=nowTask.getTaskDefinitionKey();
String executionid=nowTask.getExecutionId();
String parentexecutionid="";
String parentparentexecutionid="";
String multiinstancetype="";
String fromuser=nowTask.getAssignee();
String processInstId=nowTask.getProcessInstanceId();
Execution execution = runtimeService.createExecutionQuery().executionId(executionid).singleResult();
if(StringUtils.isNotBlank(execution.getParentId())){
parentexecutionid=execution.getParentId();
}
//判断是多人还是单人任务
Object multiInstance = nowActivity.getProperty("multiInstance");
if(multiInstance!=null){
multiinstancetype = multiInstance.toString();
if("parallel".equalsIgnoreCase(multiinstancetype)){
//分配方案为多人任务-并行
Execution parentExecution = runtimeService.createExecutionQuery().executionId(parentexecutionid).singleResult();
parentparentexecutionid=parentExecution.getParentId();
}else if("sequential".equalsIgnoreCase(multiinstancetype)){
//分配方案为多人任务-串行
}
}
List<ActZzTaskpzrecords> taskpzrecordsList=new ArrayList<>();
for (NextNodes nextNode : nextNodes) {
ActZzTaskpzrecords taskpzrecords=new ActZzTaskpzrecords();
taskpzrecords.setActid(actid)
.setExecutionid(executionid)
.setTaskid(taskid).setFromuser(fromuser)
.setMultiinstancetype(multiinstancetype)
.setParentexecutionid(parentexecutionid)
.setParentparentexecutionid(parentparentexecutionid)
.setToactid(nextNode.getActivityId())
.setTousers(nextNode.getTargets()).setProcessinstid(processInstId);
taskpzrecordsList.add(taskpzrecords);
}
if(taskpzrecordsList.size()>0){
taskpzrecordsService.saveBatch(taskpzrecordsList);
}
}
/**
* 完成当前任务
* @param taskId
*/
@Transactional
@Override
public void completetask(String taskId,String reason) {
Task nowTask = taskService.createTaskQuery().taskId(taskId).active().singleResult();
if(nowTask==null){
throw new ZzpaasException("没有找到该活动任务,无法办理!");
}
if(StringUtils.isBlank(nowTask.getAssignee())){
throw new ZzpaasException("当前任务没有指定办理人,无法办理!");
}
//validateTask(nowTask,reason);
//添加批注
if(StringUtils.isBlank(reason)){
reason="批转";
}
addComment(taskId,nowTask.getProcessInstanceId(),ProcessConstants.TASK_COMPLETE_FLAG, reason);
/*Map<String, Object> variable = isDuorenAndSetVariable(nowTask);
taskService.complete(taskId,variable);*/
taskService.complete(taskId);
}
CompleteTaskVo类
package com.zz.flow.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author lqx
* @date 2020/11/24 10:59
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompleteTaskVo {
private String nowTaskId;//当前任务id
private String processInstanceId;//流程实例id
private String reason;//批转原因
private List<NextNodes> nextNodes;
}
NextNodes类
package com.zz.flow.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author lqx
* @date 2020/8/19 17:54
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class NextNodes {
//private String taskType;//节点类型 个人任务/组任务/group任务 由于不做组任务 所以此属性删除
private String activityId;//节点id
private String targetType;//分配方案
private String targets;//办理人
}
退回接口如下
@Resource
private TaskService taskService;
@Autowired
private ZzTaskService zzTaskService;
@Autowired
private IActZzTaskpzrecordsService taskpzrecordsService;
@Resource
private ManagementService managementService;
@Resource
private RuntimeService runtimeService;
@Resource
private HistoryService historyService;
@Resource
private RepositoryService repositoryService;
@Override
public void rollbackTask(String taskId, String targetActivityId, String reason) {
Task nowTask = taskService.createTaskQuery().taskId(taskId).active().singleResult();
if(nowTask==null){
throw new ZzpaasException("没有找到该活动任务,无法退回!");
}
if(StringUtils.isBlank(reason)){
reason="退回";
}
//添加批注
zzTaskService.addComment(taskId,nowTask.getProcessInstanceId(), ProcessConstants.TASK_ROLLBACK_FLAG, reason);
RollbackTaskCmd2 rollbackTaskCmd=new RollbackTaskCmd2(taskId,targetActivityId,taskpzrecordsService);
Object o = managementService.executeCommand(rollbackTaskCmd);
}
RollbackTaskCmd2类
package com.zz.flow.utils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.zz.flow.constants.ProcessConstants;
import com.zz.flow.entity.ActZzTaskpzrecords;
import com.zz.flow.service.IActZzTaskpzrecordsService;
import com.zz.utils.exception.ZzpaasException;
import lombok.Data;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.impl.HistoricTaskInstanceQueryImpl;
import org.activiti.engine.impl.cmd.GetDeploymentProcessDefinitionCmd;
import org.activiti.engine.impl.context.Context;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.*;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.impl.variable.VariableType;
import org.activiti.engine.impl.variable.VariableTypes;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 致力于改造成一个可以分支退回主线的cmd
* 思路 : 根据
* 1.主线任务 主线多人任务
* 2.主线到分支的 单人任务 多人任务
* 3.分支到分支的单人任务 多人任务
* 4.分支到分支到分支 单人任务 多人任务
* 观察ACT_RU_EXECUTION 各个字段的变化情况 总结规律
* 退回时删除目标节点发出的所有在办任务和执行对象 和多人任务的流程变量
* 并生成目标节点的任务和执行对象及父执行对象
* @author lqx
* @date 2020/8/24 9:57
*/
@Data
public class RollbackTaskCmd2 implements Command<Object> {
private String nowTaskId;
private String targetActId;
private IActZzTaskpzrecordsService taskpzrecordsService;
private String deleteReason= ProcessConstants.TASK_ROLLBACK_FLAG;
private boolean isGetDeleteTask=false;
public RollbackTaskCmd2(String nowTaskId, String targetActId, IActZzTaskpzrecordsService taskpzrecordsService) {
this.nowTaskId = nowTaskId;
this.targetActId = targetActId;
this.taskpzrecordsService = taskpzrecordsService;
}
public RollbackTaskCmd2(String nowTaskId, String targetActId, IActZzTaskpzrecordsService taskpzrecordsService, String deleteReason) {
this.nowTaskId = nowTaskId;
this.targetActId = targetActId;
this.taskpzrecordsService = taskpzrecordsService;
this.deleteReason = deleteReason;
}
public RollbackTaskCmd2(String nowTaskId, String targetActId, IActZzTaskpzrecordsService taskpzrecordsService,boolean isGetDeleteTask) {
this.nowTaskId = nowTaskId;
this.targetActId = targetActId;
this.taskpzrecordsService = taskpzrecordsService;
this.isGetDeleteTask=isGetDeleteTask;
}
@Override
public Object execute(CommandContext commandContext) {
//获取当前任务
TaskEntity taskEntity = commandContext.getTaskEntityManager()
.findTaskById(nowTaskId);
//获取流程定义信息
ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
taskEntity.getProcessDefinitionId()).execute(Context
.getCommandContext());
ActivityImpl nowActivity = processDefinitionEntity
.findActivity(taskEntity.getTaskDefinitionKey());
String nowMultiInstanceStr = getMultiInstanceStr(nowActivity);
//获取该流程实例所有批转记录
List<ActZzTaskpzrecords> allTaskpzrecords = taskpzrecordsService.list(new QueryWrapper<ActZzTaskpzrecords>()
.eq("PROCESSINSTID", taskEntity.getProcessInstanceId())
.orderByAsc("CREATEDATE"));
//获取目标节点最近的一次批转记录
List<ActZzTaskpzrecords> targetActTaskpzrecords = taskpzrecordsService.list(new QueryWrapper<ActZzTaskpzrecords>()
.eq("PROCESSINSTID", taskEntity.getProcessInstanceId())
.eq("ACTID", targetActId).orderByDesc("CREATEDATE"));
if(targetActTaskpzrecords.size()==0){
throw new ZzpaasException("目标节点没有批转记录,不能退回!");
}
//获取最后一次批转记录
/*List<ActZzTaskpzrecords> lastTargetActTaskpzrecords = taskpzrecordsService.list(new QueryWrapper<ActZzTaskpzrecords>()
.eq("PROCESSINSTID", taskEntity.getProcessInstanceId())
.eq("TASKID", targetActTaskpzrecords.get(0).getTaskid()));*/
ActZzTaskpzrecords lastTargetPzRecord=targetActTaskpzrecords.get(0);
//删除相关信息
Object o = deleteActiveTask(commandContext, allTaskpzrecords, taskEntity, processDefinitionEntity,lastTargetPzRecord);
if(isGetDeleteTask){
return o;
}
//获取目标节点历史任务
List<HistoricTaskInstance> hiTargetActTask = findHiTargetActTask(commandContext, taskEntity);
//创建目标节点任务
ActivityImpl targetActivity = processDefinitionEntity
.findActivity(targetActId);
processHistoryTask(commandContext,taskEntity
,lastTargetPzRecord,targetActivity,processDefinitionEntity,hiTargetActTask);
//添加到批转轨迹
String parentExecutionId="";
String parentParentExecutionId="";
if(nowMultiInstanceStr.equals("parallel")){//并行
parentExecutionId=taskEntity.getExecution().getParent().getId();
parentParentExecutionId=taskEntity.getExecution().getParent().getParent().getId();
}else if(nowMultiInstanceStr.equals("sequential")){//串行
parentExecutionId=taskEntity.getExecution().getParent().getId();
}else{
if(StringUtils.isNotBlank(taskEntity.getExecution().getParentId())){
parentExecutionId=taskEntity.getExecution().getParentId();
}
}
//获取办理人
String toUsers="";
List<String> blrSet=new ArrayList<>();//办理人set
for (HistoricTaskInstance historicTaskInstancesByQueryCriterion : hiTargetActTask) {
if(!blrSet.contains(historicTaskInstancesByQueryCriterion.getAssignee())){
blrSet.add(historicTaskInstancesByQueryCriterion.getAssignee());
}
}
if(StringUtils.isBlank(lastTargetPzRecord.getMultiinstancetype())){
toUsers=blrSet.get(0);
}else{
toUsers=StringUtils.join(blrSet,",");
}
taskpzrecordsService.save(new ActZzTaskpzrecords()
.setActid(taskEntity.getTaskDefinitionKey())
.setExecutionid(taskEntity.getExecutionId())
.setParentexecutionid(parentExecutionId).setParentparentexecutionid(parentParentExecutionId)
.setFromuser(taskEntity.getAssignee()).setMultiinstancetype(nowMultiInstanceStr)
.setProcessinstid(taskEntity.getProcessInstanceId()).setTaskid(taskEntity.getId())
.setToactid(targetActId)
.setTousers(toUsers));
return o;
}
private Object deleteActiveTask(CommandContext commandContext,List<ActZzTaskpzrecords> allTaskpzrecords, TaskEntity taskEntity,ProcessDefinitionEntity processDefinitionEntity,ActZzTaskpzrecords lastTargetPzRecord) {
List<Map<String,String>> deleteTaskMap=new ArrayList<>();
//获取流程实例
String processInstanceId = taskEntity.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstance = commandContext.getHistoricProcessInstanceEntityManager().findHistoricProcessInstance(processInstanceId);
Date startTime = historicProcessInstance.getStartTime();
//获取从目标节点最后一次批转出的所有记录
List<ActZzTaskpzrecords> lastTargetActTaskpzrecords = taskpzrecordsService.list(new QueryWrapper<ActZzTaskpzrecords>()
.eq("PROCESSINSTID", taskEntity.getProcessInstanceId())
.eq("TASKID", lastTargetPzRecord.getTaskid()).orderByAsc("CREATEDATE"));
List<ActZzTaskpzrecords> allRecordsFromTargetActId = getAllRecordsFromTargetActId(allTaskpzrecords, targetActId, lastTargetActTaskpzrecords.get(0).getCreatedate());
Set<String> executionIdsNotEqFlowId=new HashSet<>();
Set<String> collect =new HashSet<>();
for (ActZzTaskpzrecords taskpzrecords : allRecordsFromTargetActId) {
collect.add(taskpzrecords.getToactid());
String multiinstancetype = taskpzrecords.getMultiinstancetype();
if(StringUtils.isBlank(multiinstancetype)){
if(!taskpzrecords.getExecutionid().equals(processInstanceId)){
executionIdsNotEqFlowId.add(taskpzrecords.getExecutionid());
}
}else if(multiinstancetype.equals("parallel")){
if(!taskpzrecords.getParentparentexecutionid().equals(processInstanceId)){
executionIdsNotEqFlowId.add(taskpzrecords.getParentparentexecutionid());
}
}else if(multiinstancetype.equals("sequential")){
if(!taskpzrecords.getParentexecutionid().equals(processInstanceId)){
executionIdsNotEqFlowId.add(taskpzrecords.getParentexecutionid());
}
}
}
TaskEntityManager taskEntityManager = commandContext.getTaskEntityManager();
List<TaskEntity> tasks = taskEntityManager.findTasksByProcessInstanceId(processInstanceId);
List<TaskEntity> deleteTasks=new ArrayList<>();
for (TaskEntity task : tasks) {
String taskDefinitionKey = task.getTaskDefinitionKey();
if(collect.contains(taskDefinitionKey)){
deleteTasks.add(task);
Map<String,String> taskMap=new HashMap<>();
taskMap.put("actId",task.getTaskDefinitionKey());
taskMap.put("name",task.getName());
deleteTaskMap.add(taskMap);
}
}
if(isGetDeleteTask){
return deleteTaskMap;
}
ExecutionEntityManager executionEntityManager = Context
.getCommandContext().getExecutionEntityManager();
VariableInstanceEntityManager variableInstanceEntityManager = Context.
getCommandContext().getVariableInstanceEntityManager();
List<ExecutionEntity> parentExecutionForDelete=new ArrayList<>();
List<ExecutionEntity> parentParentExecutionForParallel=new ArrayList<>();
Set<ExecutionEntity> executions=new HashSet<>();
//只删除任务不删除执行对象的列表
List<ExecutionEntity> executionsNotDel=new ArrayList<>();
for (TaskEntity deleteTask : deleteTasks) {
ActivityImpl activity = processDefinitionEntity
.findActivity(deleteTask.getTaskDefinitionKey());
String multiInstanceStr = getMultiInstanceStr(activity);
ExecutionEntity execution = deleteTask.getExecution();
if(StringUtils.isBlank(multiInstanceStr)){//删除的任务是单人任务
//taskEntityManager.deleteTask(taskEntity, deleteReason, false);
if(!execution.getId().equals(processInstanceId)){
//删除执行对象
executions.add(execution);
//executionEntityManager.delete(execution);
}else{
taskEntityManager.deleteTask(taskEntity, deleteReason, false);
}
}else{//多人任务
List<ExecutionEntity> executionEntitys = executionEntityManager.
findChildExecutionsByParentExecutionId(execution.getParentId());
//删除执行对象
executions.addAll(executionEntitys);
//executionEntityManager.delete(execution);
// 删除任务的原因
//taskEntityManager.deleteTask(taskEntity,deleteReason , false);
if(multiInstanceStr.equals("parallel")){//并行
ExecutionEntity parent = execution.getParent();
parentExecutionForDelete.add(parent);
ExecutionEntity parentParent = parent.getParent();
parentParentExecutionForParallel.add(parentParent);
}else if(multiInstanceStr.equals("sequential")){//串行
ExecutionEntity parent = execution.getParent();
String parentId = parent.getId();
if(!parentId.equals(processInstanceId)){
parentExecutionForDelete.add(parent);
}
}
}
}
//批转记录中所有等待中的执行对象
for (String s : executionIdsNotEqFlowId) {
ExecutionEntity executionById = executionEntityManager.findExecutionById(s);
if(executionById!=null&&!executionById.isActive()){
List<ExecutionEntity> childExecutionsByParentExecutionId = executionEntityManager.findChildExecutionsByParentExecutionId(executionById.getId());
if(childExecutionsByParentExecutionId.isEmpty()){
//说明这个执行对象正在等待 需删除
executions.add(executionById);
}
}
}
for (ExecutionEntity execution : executions) {
//删除流程变量
List<VariableInstanceEntity> varLis2 = variableInstanceEntityManager.findVariableInstancesByExecutionId(execution.getId());
for (VariableInstanceEntity variableInstanceEntity : varLis2) {
variableInstanceEntityManager.delete(variableInstanceEntity);
}
// 根据executionId 获取Task
Iterator<TaskEntity> localIterator = Context.getCommandContext()
.getTaskEntityManager()
.findTasksByExecutionId(execution.getId()).iterator();
while (localIterator.hasNext()) {
TaskEntity taskEntity2 = (TaskEntity) localIterator.next();
// 删除任务的原因
Context.getCommandContext().getTaskEntityManager()
.deleteTask(taskEntity2,deleteReason , false);
}
executionEntityManager.delete(execution);
}
for (ExecutionEntity executionEntity : parentExecutionForDelete) {
//删除流程变量
List<VariableInstanceEntity> varLis2 = variableInstanceEntityManager.findVariableInstancesByExecutionId(executionEntity.getId());
for (VariableInstanceEntity variableInstanceEntity : varLis2) {
variableInstanceEntityManager.delete(variableInstanceEntity);
}
//删除执行对象
executionEntityManager.delete(executionEntity);
}
for (ExecutionEntity executionEntity : parentParentExecutionForParallel) {
if(!executionEntity.getId().equals(processInstanceId)){
//删除流程变量
List<VariableInstanceEntity> varLis2 = variableInstanceEntityManager.
findVariableInstancesByExecutionId(executionEntity.getId());
for (VariableInstanceEntity variableInstanceEntity : varLis2) {
variableInstanceEntityManager.delete(variableInstanceEntity);
}
executionEntityManager.delete(executionEntity);
}
}
return deleteTaskMap;
}
/**
* 递归获取从目标节点批转出的所有记录
* @param list
* @param actId
* @param afterDate
* @return
*/
public List<ActZzTaskpzrecords> getAllRecordsFromTargetActId(List<ActZzTaskpzrecords> list, String actId, Date afterDate){
List<ActZzTaskpzrecords> resultList=new ArrayList<>();
List<ActZzTaskpzrecords> afterPizhuanRecordByActIdAndDate = getAfterPizhuanRecordByActIdAndDate(list, actId, afterDate);
if(afterPizhuanRecordByActIdAndDate.size()>0){
for (ActZzTaskpzrecords taskpzrecords : afterPizhuanRecordByActIdAndDate) {
resultList.add(taskpzrecords);
resultList.addAll(getAllRecordsFromTargetActId(list,taskpzrecords.getToactid(),taskpzrecords.getCreatedate()));
}
}
return resultList;
}
public List<ActZzTaskpzrecords> getAfterPizhuanRecordByActIdAndDate(List<ActZzTaskpzrecords> list, String actId, Date afterDate){
List<ActZzTaskpzrecords> resultList=new ArrayList<>();
ActZzTaskpzrecords firstAfterDate=null;
for (ActZzTaskpzrecords taskpzrecords : list) {
if(taskpzrecords.getCreatedate().getTime()>=afterDate.getTime()){
if(taskpzrecords.getActid().equals(actId)){
firstAfterDate=taskpzrecords;
break;
}
}
}
if(firstAfterDate!=null){
for (ActZzTaskpzrecords taskpzrecords : list) {
if(taskpzrecords.getTaskid().equals(firstAfterDate.getTaskid())){
resultList.add(taskpzrecords);
}
}
}
return resultList;
}
/**
* 判断是否多人任务. parallel/sequential
*/
public String getMultiInstanceStr(ActivityImpl activity) {
Object multiInstance = activity.getProperty("multiInstance");
if(multiInstance!=null){
return multiInstance.toString();
}else{
return "";
}
}
/**
* 获取目标节点的所有历史任务
* @param commandContext
* @param taskEntity
* @return
*/
public List<HistoricTaskInstance> findHiTargetActTask(CommandContext commandContext, TaskEntity taskEntity){
HistoricTaskInstanceQueryImpl historicTaskInstanceQueryImpl = new HistoricTaskInstanceQueryImpl();
historicTaskInstanceQueryImpl.taskDefinitionKey(targetActId)
.processInstanceId(taskEntity.getProcessInstanceId())
.finished().orderByHistoricTaskInstanceEndTime().desc();
List<HistoricTaskInstance> historicTaskInstancesByQueryCriteria = commandContext.getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstancesByQueryCriteria(
historicTaskInstanceQueryImpl);
return historicTaskInstancesByQueryCriteria;
}
/**
* 根据任务历史,创建待办任务.
* @param commandContext
* @param taskEntity
* @param lastTargetPzRecord
*/
public void processHistoryTask(CommandContext commandContext,TaskEntity taskEntity
,ActZzTaskpzrecords lastTargetPzRecord,ActivityImpl targetActivity
,ProcessDefinitionEntity processDefinitionEntity,List<HistoricTaskInstance> hiTargetActTask) {
if(StringUtils.isBlank(lastTargetPzRecord.getMultiinstancetype())){//目标节点是单人任务
rollbackToSingleTaskForCreate(commandContext,hiTargetActTask,lastTargetPzRecord,targetActivity,processDefinitionEntity,taskEntity);
}else{//目标节点是多人任务
rollbackToMoreTaskForCreate(commandContext,hiTargetActTask,lastTargetPzRecord,targetActivity,taskEntity,processDefinitionEntity);
}
}
/*public List<Map<String, Object>> getPreAct(String nowActivityId, ProcessDefinitionEntity processDefinitionEntity) {
List<Map<String, Object>> resultList = new ArrayList<>();
//获取当前节点
ActivityImpl activity = processDefinitionEntity.findActivity(nowActivityId);
//获取所有入线
List<PvmTransition> incomingTransitions = activity.getIncomingTransitions();
for (PvmTransition incomingTransition : incomingTransitions) {
//获取入线的开始节点
PvmActivity source = incomingTransition.getSource();
Map<String, Object> node = new HashMap<>();
node.put("activityId", source.getId());
node.put("name", source.getProperty("name"));
node.put("type", source.getProperty("type"));
resultList.add(node);
}
return resultList;
}
public List<Map<String, Object>> getAllPreAct(String nowActivityId,ProcessDefinitionEntity processDefinitionEntity){
List<Map<String, Object>> resultList = new ArrayList<>();
List<Map<String, Object>> prekActs = getPreAct(nowActivityId, processDefinitionEntity);
for (Map<String, Object> prekAct : prekActs) {
resultList.add(prekAct);
nowActivityId = prekAct.get("activityId").toString();
resultList.addAll(getAllPreAct(nowActivityId,processDefinitionEntity));
}
return resultList;
}*/
/**
* 退回到单人任务-创建相关数据
* @param commandContext
* @param hiTargetActTask
* @param lastTargetPzRecord
* @param targetActivity
*/
public void rollbackToSingleTaskForCreate(CommandContext commandContext,
List<HistoricTaskInstance> hiTargetActTask,
ActZzTaskpzrecords lastTargetPzRecord,
ActivityImpl targetActivity,ProcessDefinitionEntity processDefinitionEntity,TaskEntity taskEntity){
ExecutionEntityManager executionEntityManager = Context
.getCommandContext().getExecutionEntityManager();
ExecutionEntity mainExecution = executionEntityManager.findExecutionById(lastTargetPzRecord.getProcessinstid());
HistoricTaskInstance historicTaskInstance = hiTargetActTask.get(0);
String userId=historicTaskInstance.getAssignee();
// 创建新任务
TaskEntity task = TaskEntity.create(new Date());
this.setTaskEntity(task, historicTaskInstance, userId);
//是否需要创建执行对象
if(!lastTargetPzRecord.getExecutionid().equals(lastTargetPzRecord.getProcessinstid())){
//说明在分支上 需要创建执行对象
mainExecution.setActive(false);
ExecutionEntity executionEntity_parent = new ExecutionEntity();
executionEntity_parent.setParentId(mainExecution.getId());
executionEntity_parent.setCachedEntityState(6);
executionEntity_parent.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity_parent.setProcessInstance(taskEntity.getProcessInstance());
executionEntity_parent.setProcessDefinitionId(processDefinitionEntity.getId());
executionEntity_parent.setActivity(targetActivity);
executionEntity_parent.setActive(true);
executionEntity_parent.setConcurrent(true);
executionEntity_parent.setScope(false);
String id="obj"+IdWorker.getIdStr();
executionEntity_parent.setId(id);
executionEntityManager.insert(executionEntity_parent);
// 创建HistoricActivityInstance
Context.getCommandContext().getHistoryManager().recordActivityStart(executionEntity_parent);
task.setExecutionId(executionEntity_parent.getId());
commandContext.getTaskEntityManager().insert(task);
// 创建HistoricTaskInstance
Context.getCommandContext().getHistoryManager().recordTaskCreated(task, executionEntity_parent);
Context.getCommandContext().getHistoryManager().recordTaskId(task);
// 更新ACT_HI_ACTIVITY里的assignee字段
Context.getCommandContext().getHistoryManager().recordTaskAssignment(task);
}else{//说明在主线上 不需要创建执行对象
task.setExecutionId(mainExecution.getId());
commandContext.getTaskEntityManager().insert(task);
mainExecution.setActive(true);
mainExecution.setActivity(targetActivity);
// 创建HistoricActivityInstance
Context.getCommandContext().getHistoryManager().recordActivityStart(mainExecution);
// 创建HistoricTaskInstance
Context.getCommandContext().getHistoryManager().recordTaskCreated(task, mainExecution);
Context.getCommandContext().getHistoryManager().recordTaskId(task);
// 更新ACT_HI_ACTIVITY里的assignee字段
Context.getCommandContext().getHistoryManager().recordTaskAssignment(task);
}
}
/**
* 根据历史任务设置任务属性
* @param task
* @param historicTaskInstanceEntity
* @param userId
*/
public void setTaskEntity(TaskEntity task, HistoricTaskInstance historicTaskInstanceEntity, String userId) {
task.setProcessDefinitionId(historicTaskInstanceEntity.getProcessDefinitionId());
task.setAssigneeWithoutCascade(userId);
task.setParentTaskIdWithoutCascade(historicTaskInstanceEntity.getParentTaskId());
task.setNameWithoutCascade(historicTaskInstanceEntity.getName());
task.setTaskDefinitionKey(historicTaskInstanceEntity.getTaskDefinitionKey());
task.setFormKey(historicTaskInstanceEntity.getFormKey());
task.setPriority(historicTaskInstanceEntity.getPriority());
task.setProcessInstanceId(historicTaskInstanceEntity.getProcessInstanceId());
task.setDescriptionWithoutCascade(historicTaskInstanceEntity.getDescription());
task.setTenantId(historicTaskInstanceEntity.getTenantId());
}
/**
* 退回到多人任务-创建相关数据
* @param commandContext
* @param hiTargetActTask
* @param lastTargetPzRecord
* @param targetActivity
*/
public void rollbackToMoreTaskForCreate(CommandContext commandContext,
List<HistoricTaskInstance> hiTargetActTask,
ActZzTaskpzrecords lastTargetPzRecord,
ActivityImpl targetActivity,TaskEntity taskEntity
,ProcessDefinitionEntity processDefinitionEntity){
//获取办理人
List<String> blrSet=new ArrayList<>();//办理人set
for (HistoricTaskInstance historicTaskInstancesByQueryCriterion : hiTargetActTask) {
if(!blrSet.contains(historicTaskInstancesByQueryCriterion.getAssignee())){
blrSet.add(historicTaskInstancesByQueryCriterion.getAssignee());
}
}
//获取执行对象管理类
ExecutionEntityManager executionEntityManager = Context
.getCommandContext().getExecutionEntityManager();
ExecutionEntity mainExecution = executionEntityManager.findExecutionById(lastTargetPzRecord.getProcessinstid());
String targetMultiinstancetype = lastTargetPzRecord.getMultiinstancetype();
if(targetMultiinstancetype.equals("parallel")){//并行
mainExecution.setActive(false);
ExecutionEntity executionEntity_parent = new ExecutionEntity();
if(!lastTargetPzRecord.getParentparentexecutionid().equals(lastTargetPzRecord.getProcessinstid())){
//说明不在主线上 需创建父级执行对象
ExecutionEntity executionEntity_parent_parent = new ExecutionEntity();
executionEntity_parent_parent.setParentId(mainExecution.getId());
executionEntity_parent_parent.setCachedEntityState(6);
executionEntity_parent_parent.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity_parent_parent.setProcessInstance(taskEntity.getProcessInstance());
executionEntity_parent_parent.setProcessDefinitionId(taskEntity.getProcessDefinitionId());
executionEntity_parent_parent.setActive(false);
executionEntity_parent_parent.setConcurrent(true);
executionEntity_parent_parent.setScope(false);
String parentParentId="obj"+IdWorker.getIdStr();
executionEntity_parent_parent.setId(parentParentId);
Context.getCommandContext().getExecutionEntityManager().insert(executionEntity_parent_parent);
executionEntity_parent.setParentId(executionEntity_parent_parent.getId());
}else{
mainExecution.setActivity(targetActivity);
executionEntity_parent.setParentId(mainExecution.getId());
}
executionEntity_parent.setCachedEntityState(6);
executionEntity_parent.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity_parent.setProcessInstance(taskEntity.getProcessInstance());
executionEntity_parent.setProcessDefinitionId(taskEntity.getProcessDefinitionId());
executionEntity_parent.setActivity(targetActivity);
executionEntity_parent.setActive(false);
executionEntity_parent.setConcurrent(false);
executionEntity_parent.setScope(true);
String parentId="obj"+IdWorker.getIdStr();
executionEntity_parent.setId(parentId);
Context.getCommandContext().getExecutionEntityManager().insert(executionEntity_parent);
// 创建多实例任务
// 创建多实例任务
this.createVariable(blrSet.size(), blrSet.size(), executionEntity_parent.getId(), taskEntity.getProcessInstanceId(), "",true);
int i = 0;
for (String s : blrSet) {
ExecutionEntity executionEntity_c = new ExecutionEntity();
executionEntity_c.setParentId(executionEntity_parent.getId());
executionEntity_c.setActive(true);
executionEntity_c.setScope(false);
executionEntity_c.setConcurrent(true);
executionEntity_c.setActivity(targetActivity);
executionEntity_c.setCachedEntityState(7);
executionEntity_c.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity_c.setProcessInstance(taskEntity.getProcessInstance());
executionEntity_c.setProcessDefinitionId(taskEntity.getProcessDefinitionId());
String id="obj"+IdWorker.getIdStr();
executionEntity_c.setId(id);
Context.getCommandContext().getExecutionEntityManager().insert(executionEntity_c);
// 创建HistoricActivityInstance
Context.getCommandContext().getHistoryManager().recordActivityStart(executionEntity_c);
TaskEntity task = TaskEntity.create(new Date());
task.setExecutionId(executionEntity_c.getId());
this.setTaskEntity(task, hiTargetActTask.get(0), s);
Context.getCommandContext().getTaskEntityManager().insert(task);
// 创建HistoricTaskInstance
Context.getCommandContext().getHistoryManager().recordTaskCreated(task, executionEntity_c);
Context.getCommandContext().getHistoryManager().recordTaskId(task);
// 更新ACT_HI_ACTIVITY里的assignee字段
Context.getCommandContext().getHistoryManager().recordTaskAssignment(task);
String[] varName_ = {"loopCounter", "processUser"};
for (String name : varName_) {
VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
VariableInstanceEntity variableInstance = this.insertVariableInstanceEntity(name, i, executionEntity_c.getId(), taskEntity.getProcessInstanceId());
switch (name) {
case "loopCounter":
variableInstance.setLongValue(Long.valueOf(i));
variableInstance.setTextValue(i+"");
break;
case "processUser":
VariableType newType = variableTypes.findVariableType(s);
variableInstance.setType(newType);
variableInstance.setLongValue(null);
variableInstance.setTextValue(s);
break;
}
Context.getCommandContext().getVariableInstanceEntityManager().insert(variableInstance);
}
i++;
}
}else if(targetMultiinstancetype.equals("sequential")){//串行
ExecutionEntity executionEntity = new ExecutionEntity();
mainExecution.setActive(false);
if(!lastTargetPzRecord.getParentexecutionid().equals(lastTargetPzRecord.getProcessinstid())){
//说明不在主线上 需创建父级执行对象
//创建父级执行对象
ExecutionEntity executionEntity_parent = new ExecutionEntity();
executionEntity_parent.setParentId(mainExecution.getId());
executionEntity_parent.setCachedEntityState(6);
executionEntity_parent.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity_parent.setProcessInstance(taskEntity.getProcessInstance());
executionEntity_parent.setProcessDefinitionId(taskEntity.getProcessDefinitionId());
executionEntity_parent.setActivity(targetActivity);
executionEntity_parent.setActive(false);
executionEntity_parent.setConcurrent(true);
executionEntity_parent.setScope(false);
String parentId="obj"+ IdWorker.getIdStr();
executionEntity_parent.setId(parentId);
Context.getCommandContext().getExecutionEntityManager().insert(executionEntity_parent);
executionEntity.setParentId(executionEntity_parent.getId());
}else{//说明在主线上
mainExecution.setActivity(targetActivity);
executionEntity.setParentId(mainExecution.getId());
}
HistoricTaskInstance historicTaskInstance = hiTargetActTask.get(0);
executionEntity.setCachedEntityState(6);
executionEntity.setProcessDefinitionKey(processDefinitionEntity.getKey());
executionEntity.setProcessInstance(taskEntity.getProcessInstance());
executionEntity.setProcessDefinitionId(taskEntity.getProcessDefinitionId());
executionEntity.setActivity(targetActivity);
executionEntity.setActive(true);
executionEntity.setConcurrent(false);
executionEntity.setScope(true);
String id="obj"+ IdWorker.getIdStr();
executionEntity.setId(id);
Context.getCommandContext().getExecutionEntityManager().insert(executionEntity);
// 创建HistoricActivityInstance
Context.getCommandContext().getHistoryManager().recordActivityStart(executionEntity);
TaskEntity task = TaskEntity.create(new Date());
task.setExecutionId(executionEntity.getId());
this.setTaskEntity(task, historicTaskInstance, blrSet.get(blrSet.size()-1));
Context.getCommandContext().getTaskEntityManager().insert(task);
// 创建HistoricTaskInstance
Context.getCommandContext().getHistoryManager().recordTaskCreated(task, executionEntity);
Context.getCommandContext().getHistoryManager().recordTaskId(task);
// 更新ACT_HI_ACTIVITY里的assignee字段
Context.getCommandContext().getHistoryManager().recordTaskAssignment(task);
this.createVariable(blrSet.size(), 1, executionEntity.getId(), taskEntity.getProcessInstanceId(), blrSet.get(blrSet.size()-1),false);
}
}
/**
*
* <p>Title: 创建变量参数</p>
* <p>Description: </p>
* @param size
* @param activeInstanceSize
* @param executionEntityId
* @param processInstanceId
* @param userId
* @date 2018年8月31日
* @author lqx
*/
public void createVariable(int size, int activeInstanceSize, String executionEntityId, String processInstanceId, String userId,boolean isParallel) {
List<String> varName = new ArrayList<String>();
varName.add("nrOfInstances");
varName.add("nrOfCompletedInstances");
varName.add("nrOfActiveInstances");
if (!isParallel) {
varName.add("loopCounter");
varName.add("processUser");
}
for (String name : varName) {
VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
VariableType newType = variableTypes.findVariableType(size);
VariableInstanceEntity variableInstance = this.insertVariableInstanceEntity(name, size, executionEntityId, processInstanceId);
switch (name) {
case "nrOfInstances":
variableInstance.setLongValue(Long.valueOf(size));
break;
case "nrOfCompletedInstances":
newType = variableTypes.findVariableType(0);
variableInstance.setType(newType);
variableInstance.setLongValue(0L);
variableInstance.setTextValue("0");
break;
case "nrOfActiveInstances":
variableInstance.setLongValue(Long.valueOf(activeInstanceSize));
if (!isParallel) {
variableInstance.setTextValue(activeInstanceSize+"");
}
break;
case "loopCounter":
variableInstance.setLongValue(0L);
variableInstance.setTextValue("0");
break;
case "processUser":
newType = variableTypes.findVariableType(userId);
variableInstance.setType(newType);
variableInstance.setLongValue(null);
variableInstance.setTextValue(userId);
break;
}
Context.getCommandContext().getVariableInstanceEntityManager().insert(variableInstance);
}
}
private VariableInstanceEntity insertVariableInstanceEntity(String name, Object value, String executionId, String processInstanceId) {
VariableTypes variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
VariableType newType = variableTypes.findVariableType(value);
VariableInstanceEntity variableInstance = VariableInstanceEntity.create(name, newType, value);
variableInstance.setExecutionId(executionId);
variableInstance.setProcessInstanceId(processInstanceId);
return variableInstance;
}
}
IActZzTaskpzrecordsService类如下
public interface IActZzTaskpzrecordsService extends IService<ActZzTaskpzrecords> {
}
/**
* <p>
* 任务批转记录表 服务实现类
* </p>
*
* @author lqx
* @since 2021-02-19
*/
@Service
public class ActZzTaskpzrecordsServiceImpl extends ServiceImpl<ActZzTaskpzrecordsMapper, ActZzTaskpzrecords> implements IActZzTaskpzrecordsService {
}
)
ProcessConstants类
package com.zz.flow.constants;
/**
* 流程常量
* @author lqx
* @date 2019/12/20 16:44
*/
public class ProcessConstants {
/**
* 流程启动者对象
*/
public static final String PROCESS_NEXTID_KEY_IN_REQUEST = "zzProcessNextIdInRequest";
/**
* 流程启动者对象
*/
public static final String PROCESS_CREATER = "createUserObj";
/**
* 流程启动者部门id在流程变量中的key
*/
public static final String PROCESS_CREATERDEPID = "createUserDepId";
/**
* 任务退回时 act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_ROLLBACK_FLAG = "rollback";
/**
* 任务自由跳转时 act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_JUMP_FLAG = "jump";
/**
* 任务删除时 act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_DELETE_FLAG = "deleted";
/**
* 任务完成时 act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_COMPLETE_FLAG = "completed";
/**
* 任务撤回时 act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_RECALL_FLAG = "recall";
/**
* 任务传阅标志
*/
public static final String TASK_CIRCULATED_FLAG = "circulated";
/**
* 流程重新办理时(只适合第一个节点是人工任务的流程) act_hi_taskinst表中delete_reason标志
*/
public static final String TASK_RESTART_FLAG = "restart";
/**
* 任务挂起时 ACT_HI_COMMENT批注表中type标志
*/
public static final String TASK_SUSPEND_FLAG = "suspend";
/**
* 任务激活时 ACT_HI_COMMENT批注表中type标志 activate
*/
public static final String TASK_ACTIVATE_FLAG = "activate";
/**
* 任务创建标志
*/
public static final String TASK_CREATE_FLAG = "create";
/**
* 任意指定 档再流程设计中assignee设置为${user_节点id}时 办理人分配方案即为任意指定
*/
public static final String TARGET_ASSIGNEE_TYPE_RYZD = "${user_";//
/**
* 任意指定的流程变量key user_节点id
*/
public static final String TARGET_ASSIGNEE_TYPE_RYZD_VARIABLES_KEY = "user_";//
/**
* 流程启动着 档再流程设计中assignee设置为${createUser}时 办理人分配方案即为流程启动着
*/
public static final String TARGET_ASSIGNEE_TYPE_LCQDZ = "${createUser}";//
/**
* 流程启动者的流程变量key
*/
public static final String TARGET_ASSIGNEE_TYPE_LCQDZ_VARIABLES_KEY = "createUser";
/**
* 如果节点办理人分配方案是人员指定(由用户指定) 则返回targetType为TARGET_TYPE_RYZD 来标识该节点的分配方案为任意指定
*/
public static final String TARGET_TYPE_RYZD = "TARGET_TYPE_RYZD";
/**
* 如果节点办理人分配方案是流程启动着 则返回targetType为TARGET_TYPE_LCQDZ 来标识该节点的分配方案为流程启动着
*/
public static final String TARGET_TYPE_LCQDZ = "TARGET_TYPE_LCQDZ";
/**
* 如果节点办理人分配方案是固定某人员 则返回targetType为TARGET_TYPE_GDRY 来标识该节点的分配方案为固定某人员
*/
public static final String TARGET_TYPE_GDRY = "TARGET_TYPE_GDRY";
/**
* 如果节点办理人分配方案是候选人模式 则返回targetType为TARGET_TYPE_HXR 来标识该节点的分配方案为候选人
*/
public static final String TARGET_TYPE_HXR = "TARGET_TYPE_HXR";
/**
* 如果节点办理人分配方案是候选组模式 则返回targetType为TARGET_TYPE_HXZ 来标识该节点的分配方案为候选组
*/
public static final String TARGET_TYPE_HXZ = "TARGET_TYPE_HXZ";
/**
* 任务类型: 个人任务
*/
public static final String TASK_TYPE_ASSIGNEE = "assignee";
/**
* 任务类型: 候选人任务
*/
public static final String TASK_TYPE_CANDIDATEUSERID = "candidateUserId";
/**
* 任务类型: 候选组任务
*/
public static final String TASK_TYPE_CANDIDATEGROUP = "candidateGroup";
//多人任务=================================================
/**
* 实例总数(多少个人办理就有多少个实例) taskCount_节点id activiti存的有 所以不需要再存一份
*/
//public static final String TASK_ZONG_COUNT_KEY = "taskCount_";
/**
* 完成实例数 taskCompleteCount_节点id activiti存的有 所以不需要再存一份
*/
//public static final String TASK_COMPLETE_COUNT_KEY = "taskCompleteCount_";
/**
*
* 多人任务 (多人任务的办理人集合) ${list_节点id}
*/
public static final String TARGET_ASSIGNEE_TYPE_DUOREN_LIST = "${list_";
public static final String TARGET_ASSIGNEE_TYPE_DUOREN_LIST_KEY = "list_";
/**
*
* 多人任务 (多人任务都是多个人的个人任务 分配方案从集合中取出的item) ${iuser_节点id}
*/
public static final String TARGET_ASSIGNEE_TYPE_DUOREN_ITEM = "${user_";//
/**
* 如果节点办理人分配方案是多人任务 则返回targetType为TARGET_TYPE_DUOREN 来标识该节点的分配方案为多人任务
*/
public static final String TARGET_TYPE_DUOREN_BINGXING = "TARGET_TYPE_DUOREN_BINGXING";//并行
public static final String TARGET_TYPE_DUOREN_CHUANXING = "TARGET_TYPE_DUOREN_CHUANXING";//串行
/**
* 人工干预(当包容网关或者排他网关有多个成立的条件时 线上可能设置了人工干预,就是人为选一条或多条成立,选择的线id存放流程变量的key)
* RGGY_网关id
*/
public static final String RGGY_KEY = "RGGY_";//串行
/**
* 流程状态 流程状态run正在运行end办结delete作废suspended挂起
*/
public static final String PROCESS_STATE_RUN = "run";
/**
* 流程状态 流程状态run正在运行end办结delete作废suspended挂起
*/
public static final String PROCESS_STATE_END = "end";
/**
* 流程状态 流程状态run正在运行end办结deleted作废suspended挂起
*/
public static final String PROCESS_STATE_DELETED = "deleted";
/**
* 流程状态 流程状态run正在运行end办结delete作废suspended挂起
*/
public static final String PROCESS_STATE_SUSPENDED = "suspended";
}