提交 61b5dcea 编写于 作者: lengyu's avatar lengyu

工作流辅助功能(加签、转办、回退)

上级 c4f13d71
......@@ -546,7 +546,7 @@ public class WFCoreService
//加签逻辑
String procFuncs = getParam(userTask,"form","procfunc");
if(DelegationState.PENDING == task.getDelegationState() && userId.equals(task.getAssignee())
&& !StringUtils.isEmpty(procFuncs) && procFuncs.contains(ProcFunction.BEFORESIGN.value)){
&& !StringUtils.isEmpty(procFuncs) && procFuncs.contains(ProcFunction.ADDSTEPBEFORE.value)){
WFTaskWay way = getFuncWay(task,ProcFunction.FINISH.value);
if(way!=null)
taskWays.add(way);
......@@ -630,33 +630,29 @@ public class WFCoreService
}
/**
* 流程辅助功能连接
* 流程辅助功能连接(通过type区分预定义行为与标准行为)
* @param funcType
* @return
*/
public WFTaskWay getFuncWay(Task task , String funcType){
WFTaskWay way = new WFTaskWay();
if(funcType.equals(ProcFunction.ROLLBACK.value)){
way.set("type",ProcFunction.ROLLBACK.value);
way.setSequenceflowname(ProcFunction.ROLLBACK.text);
}
else if(funcType.equals(ProcFunction.BEFORESIGN.value)){
way.set("type",ProcFunction.BEFORESIGN.value);
way.setSequenceflowname(ProcFunction.BEFORESIGN.text);
}
else if(funcType.equals(ProcFunction.TRANSFER.value)){
way.set("type",ProcFunction.TRANSFER.value);
way.setSequenceflowname(ProcFunction.TRANSFER.text);
}
else if(funcType.equals(ProcFunction.FINISH.value)){
way.set("type",ProcFunction.FINISH.value);
way.setSequenceflowname(ProcFunction.FINISH.text);
}
else{
WFTaskWay way = null;
try {
if(!StringUtils.isEmpty(funcType)){
ProcFunction function = ProcFunction.valueOf(funcType.toUpperCase());
if(function!=null){
if(function == ProcFunction.ADDSTEPAFTER){
function = ProcFunction.TRANSFER;
}
way = new WFTaskWay();
way.set("type",function.value);
way.setSequenceflowname(function.text);
way.setTaskid(task.getId());
way.setTaskdefinitionkey(task.getTaskDefinitionKey());
}
}
} catch (IllegalArgumentException e) {
return null;
}
way.setTaskid(task.getId());
way.setTaskdefinitionkey(task.getTaskDefinitionKey());
return way;
}
......@@ -1374,6 +1370,88 @@ public class WFCoreService
return strUsers;
}
/**
* 获取工作流角色成员
* @param groupIds
* @param delegateExecution
* @return
*/
public Set<WFMember> getGroupUsers2(String groupIds, DelegateExecution delegateExecution)
{
Set <String> orgList =new HashSet<>();
Set <String> deptList = new HashSet<>();
Set <WFMember> memberList = new HashSet<>();
Object activedata=delegateExecution.getVariable("activedata");
if(delegateExecution == null || activedata == null){
throw new BadRequestAlertException("获取业务数据失败","","");
}
if(StringUtils.isEmpty(groupIds))
throw new BadRequestAlertException("当前步骤未配置用户组","","");
String[] groups=groupIds.split(",");
for(String groupId:groups)
{
String userData="";
String userData2="";
if(groupId.indexOf("|")>0)
{
String[] arg=groupId.split("[|]");
if(arg.length==3)
{
groupId=arg[0];
if(arg[1]!=null)
userData=arg[1].toLowerCase();
if(arg[2]!=null)
userData2=arg[2].toLowerCase();
}
}
if((!StringUtils.isEmpty(userData))&&(!StringUtils.isEmpty(userData2)))
{
for(String field : userData2.split(";")){
Object fieldvalue = null;
if(field.indexOf("srf")==0)
{
FlowUser curUser=FlowUser.getCurUser();
if(curUser!=null&&curUser.getUser()!=null){
fieldvalue=curUser.getUser().getSessionParams().get(field);
}
}
else {
if(activedata instanceof Map) {
fieldvalue = ((Map) activedata).get(field);
}
}
if(fieldvalue!=null){
if("org".equals(userData)){
orgList.addAll(Arrays.asList(String.valueOf(fieldvalue).split(";")));
}
else if("dept".equals(userData)){
deptList.addAll(Arrays.asList(String.valueOf(fieldvalue).split(";")));
}
}
}
}
WFGroup group=iwfGroupService.get(groupId);
List<WFMember> list=group.getWfmember();
if (list!=null)
{
for(WFMember member : list)
{
String orgId = member.getOrgid();
String deptId = member.getMdeptid();
if(ObjectUtils.isEmpty(orgList) && ObjectUtils.isEmpty(deptList)){
memberList.add(member);
}
else{
if((!ObjectUtils.isEmpty(orgId) && orgList.contains(orgId)) || (!ObjectUtils.isEmpty(deptId) && deptList.contains(deptId))){
memberList.add(member);
}
}
}
}
}
return memberList;
}
/**
* 后加签 (转办-工作转移)
......@@ -1448,93 +1526,6 @@ public class WFCoreService
return true;
}
/**
* 返回组成员,用于多实例会签( wfroleid = groupid +deptid )
* @param groupIds
* @param delegateExecution
* @return
*/
public List<WFMember> getGroupUsers2(String groupIds, DelegateExecution delegateExecution)
{
List<WFMember> users= new ArrayList<>();
if(StringUtils.isEmpty(groupIds))
return users;
String[] groups=groupIds.split(",");
for(String groupId:groups)
{
String userData="";
String userData2="";
String orgid="";
String deptid="";
if(groupId.indexOf("|")>0)
{
String[] arg=groupId.split("[|]");
if(arg.length==3)
{
groupId=arg[0];
if(arg[1]!=null)
userData=arg[1].toLowerCase();
if(arg[2]!=null)
userData2=arg[2].toLowerCase();
}
}
if((!StringUtils.isEmpty(userData))&&(!StringUtils.isEmpty(userData2)))
{
if(userData2.indexOf("srf")==0)
{
FlowUser curUser=FlowUser.getCurUser();
if(curUser!=null&&curUser.getUser()!=null)
{
Object sessionValue=curUser.getUser().getSessionParams().get(userData2);
if(sessionValue!=null)
userData2=sessionValue.toString();
else
userData2="";
}
else
userData2="";
}
else
{
Object activedata=delegateExecution.getVariable("activedata");
if(activedata!=null&&activedata instanceof Map) {
Map entity = (Map) activedata;
if(entity.get(userData2)!=null)
userData2=entity.get(userData2).toString();
else
userData2="";
}
else
userData2="";
}
if(!StringUtils.isEmpty(userData2))
{
if(userData.indexOf("dept")>=0||userData.indexOf("orgsec")>=0)
deptid=userData2;
else if(userData.indexOf("org")>=0)
orgid=userData2;
}
}
WFGroup group=iwfGroupService.get(groupId);
List<WFMember> list=group.getWfmember();
if (list!=null)
{
for(WFMember member : list)
{
if((!StringUtils.isEmpty(deptid))&&(!deptid.equals(member.getMdeptid())))
continue;
if((!StringUtils.isEmpty(orgid))&&(!orgid.equals(member.getOrgid())))
continue;
users.add(member);
}
}
}
return users;
}
private ByteArrayOutputStream getBpmnFile(InputStream input) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
......
......@@ -4,21 +4,14 @@ package cn.ibizlab.util.enums;
* 工作流辅助功能
*/
public enum ProcFunction {
/**
* 退回
*/
ROLLBACK("rollback","退回"),
/**
* 前加签
*/
BEFORESIGN("beforesign","前加签"),
/**
* 转办
*/
SENDBACK("sendback","退回"),
SUPPLYINFO("supplyinfo","补充信息"),
ADDSTEPBEFORE("addstepbefore","前加签"),
ADDSTEPAFTER("addstepafter","后加签"),
TAKEADVICE("takeadvice","征求意见"),
SENDCOPY("sendcopy","抄送"),
TRANSFER("transfer","转办"),
/**
* 加签完成
*/
FINISH("finish","完成");
ProcFunction(String value, String text) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册