|
|
|
|
@ -188,7 +188,7 @@ public class WfProcessService implements IWfProcessService { |
|
|
|
|
|
|
|
|
|
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefId, definition.getKey(), variables); |
|
|
|
|
return handleProcessInstance(processInstance, variables); |
|
|
|
|
}else if(this.isNewProcess(variables) && StringUtils.equals(variables.get("forcestart").toString(),"0")){ |
|
|
|
|
}else if(this.isRepeatProcess(variables) && StringUtils.equals(variables.get("forcestart").toString(),"0")){ |
|
|
|
|
return "类似任务已经发起过,是否要强制发起"; |
|
|
|
|
}else{ |
|
|
|
|
//如果是技术员发起的一般任务,直接指定assignee = 公司
|
|
|
|
|
@ -226,8 +226,9 @@ public class WfProcessService implements IWfProcessService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//判断该类型的流程是否已经发起过,false:有重复的,true:没重复
|
|
|
|
|
private boolean isNewProcess(Map<String, Object> variables){ |
|
|
|
|
//判断该类型的流程是否已经发起过,true false
|
|
|
|
|
//variables,本次发起的工作流的表单数据
|
|
|
|
|
private boolean isRepeatProcess(Map<String, Object> variables){ |
|
|
|
|
|
|
|
|
|
boolean b = false; |
|
|
|
|
LambdaQueryWrapper<AutoStartModel> queryWrapper = Wrappers.lambdaQuery(); |
|
|
|
|
@ -241,10 +242,8 @@ public class WfProcessService implements IWfProcessService { |
|
|
|
|
|
|
|
|
|
if (processInstanceVariable.size() > 0) { |
|
|
|
|
for(Map<String,Object> hi : processInstanceVariable){ |
|
|
|
|
boolean noEqual = this.isNoEqual(variables, hi); |
|
|
|
|
if(noEqual){//有不相等的,直接下一次循环判断
|
|
|
|
|
continue; |
|
|
|
|
}else{//没有不相等的,说明有重复的,结束循环,返回b=true
|
|
|
|
|
boolean isAllEqual = this.isAllEqual(variables, hi); |
|
|
|
|
if(isAllEqual){ |
|
|
|
|
b = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
@ -254,8 +253,9 @@ public class WfProcessService implements IWfProcessService { |
|
|
|
|
|
|
|
|
|
return b; |
|
|
|
|
} |
|
|
|
|
//判断是否有不相等的,true 有 false没有
|
|
|
|
|
private boolean isNoEqual(Map<String,Object> map1, Map<String,Object> map2){ |
|
|
|
|
//判断是否全部相等 ,true 是 false 否
|
|
|
|
|
private boolean isAllEqual(Map<String,Object> map1, Map<String,Object> map2){ |
|
|
|
|
boolean result = true; |
|
|
|
|
Set<Map.Entry<String, Object>> entries = map1.entrySet(); |
|
|
|
|
Iterator<Map.Entry<String, Object>> iterator = entries.iterator(); |
|
|
|
|
while(iterator.hasNext()){ |
|
|
|
|
@ -264,11 +264,13 @@ public class WfProcessService implements IWfProcessService { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!Func.equals(next.getValue(),map2.get(next.getKey()))){ |
|
|
|
|
return true; |
|
|
|
|
if(StringUtils.equals(next.getValue().toString(),map2.get(next.getKey()).toString())){ |
|
|
|
|
continue; |
|
|
|
|
}else{ |
|
|
|
|
result = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|