xiangpei
2024-12-10 5cd0e50ccbc6e10dd4e488d8b4106e82fb676521
flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
@@ -146,4 +146,31 @@
//        }
    }
    /**
     * 检查任务节点是否配置了:需要审核  的扩展属性
     *
     * @param extensionElements 扩展列表
     * @return
     */
    public Boolean checkTaskNeedAuditing(List<ExtensionElement> extensionElements) {
        if (CollectionUtils.isEmpty(extensionElements)) {
            return Boolean.FALSE;
        }
        for (ExtensionElement extensionElement : extensionElements) {
            if (CollectionUtils.isEmpty(extensionElement.getAttributes())) { // 如果本身没有属性,则递归child
                return checkTaskNeedAuditing(extensionElement.getChildElements().get("property"));
            } else {
                // 否则先查本身的属性有不有:需要审核 的属性,没有也是递归child
                if (extensionElement.getAttributes().get("name").stream().anyMatch(attribute -> ProcessConstants.EXTENSION_PROPERTY_NEED_AUDITING_TEXT.equals(attribute.getValue()))
                    && extensionElement.getAttributes().get("value").stream().anyMatch(attribute -> ProcessConstants.EXTENSION_PROPERTY_NEED_AUDITING_VALUE.equals(attribute.getValue()))
                ) {
                    return Boolean.TRUE;
                } else {
                    return checkTaskNeedAuditing(extensionElement.getChildElements().get("property"));
                }
            }
        }
        return Boolean.FALSE;
    }
}