|
|
|
|
@ -31,10 +31,7 @@ import org.dromara.workflow.service.IFlwNodeExtService;
|
|
|
|
|
import org.dromara.workflow.service.IFlwTaskService;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 全局任务办理监听
|
|
|
|
|
@ -79,7 +76,16 @@ public class WorkflowGlobalListener implements GlobalListener {
|
|
|
|
|
Map<String, Object> variable = listenerVariable.getVariable();
|
|
|
|
|
Set<String> copyList = nodeExt.getCopySettings();
|
|
|
|
|
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();
|
|
|
|
|
Long id = Convert.toLong(x);
|
|
|
|
|
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);
|
|
|
|
|
if (submit != null && submit) {
|
|
|
|
|
if (submit != null && submit && !instance.getNodeCode().equals("end")) {
|
|
|
|
|
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, instance.getFlowStatus(), variable, true);
|
|
|
|
|
} else {
|
|
|
|
|
// 判断流程状态(发布:撤销,退回,作废,终止,已完成事件)
|
|
|
|
|
|