1.0.52 审批流抄送人可用变量,申请人可结束流程

dev
yinq 2 weeks ago
parent f4ad181d7d
commit 68c1c1bdb7

@ -31,10 +31,7 @@ import org.dromara.workflow.service.IFlwNodeExtService;
import org.dromara.workflow.service.IFlwTaskService; import org.dromara.workflow.service.IFlwTaskService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* *
@ -79,7 +76,16 @@ public class WorkflowGlobalListener implements GlobalListener {
Map<String, Object> variable = listenerVariable.getVariable(); Map<String, Object> variable = listenerVariable.getVariable();
Set<String> copyList = nodeExt.getCopySettings(); Set<String> copyList = nodeExt.getCopySettings();
if (CollUtil.isNotEmpty(copyList)) { if (CollUtil.isNotEmpty(copyList)) {
List<FlowCopyBo> list = StreamUtils.toList(copyList, x -> { Set<String> newList = new HashSet<>();
for (String copy : copyList) {
if (isVariableFormat(copy)) {
String str = String.valueOf(variable.get(extractVariableContent(copy)));
newList.addAll(Arrays.asList(str.split(",")));
} else {
newList.add(copy);
}
}
List<FlowCopyBo> list = StreamUtils.toList(newList, x -> {
FlowCopyBo bo = new FlowCopyBo(); FlowCopyBo bo = new FlowCopyBo();
Long id = Convert.toLong(x); Long id = Convert.toLong(x);
bo.setUserId(id); bo.setUserId(id);
@ -94,6 +100,31 @@ public class WorkflowGlobalListener implements GlobalListener {
} }
} }
/**
* ${***}
* @param input
* @return
*/
public static boolean isVariableFormat(String input) {
if (input == null || input.length() < 4) { // 最小长度: ${a}
return false;
}
return input.startsWith("${") && input.endsWith("}");
}
/**
* ${***}
* @param input
* @return
*/
public static String extractVariableContent(String input) {
if (!isVariableFormat(input)) {
return null;
}
// 去掉 ${ 和 }
return input.substring(2, input.length() - 1);
}
/** /**
* *
* *
@ -146,7 +177,7 @@ public class WorkflowGlobalListener implements GlobalListener {
} }
//申请人提交事件 //申请人提交事件
Boolean submit = MapUtil.getBool(variable, FlowConstant.SUBMIT); Boolean submit = MapUtil.getBool(variable, FlowConstant.SUBMIT);
if (submit != null && submit) { if (submit != null && submit && !instance.getNodeCode().equals("end")) {
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, instance.getFlowStatus(), variable, true); flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, instance.getFlowStatus(), variable, true);
} else { } else {
// 判断流程状态(发布:撤销,退回,作废,终止,已完成事件) // 判断流程状态(发布:撤销,退回,作废,终止,已完成事件)

Loading…
Cancel
Save