开发人员通过自定义函数在工作流分支原有的函数基础上进行扩展,完成预置函数不能完成的逻辑。
可从外部系统取数控制表单流程流转,比如可以在处理时实时从ERP取数决定流转的分支。



代码实现非常简单,定义任意类,加上相关注解,在Spring中注册即可
package com.seeyon.ctp.common.function.test; import com.seeyon.ctp.util.annotation.Function; public class ERPFunctions { @Function(title = "wffuncdemo.checkbudget.title"
, description = "wffuncdemo.checkbudget.description"
, category = "wf_branch_function"
) public static boolean isBudgetAvailable
(String department, double amount) { System.out.println("部门:" + department + "未超出预算."); return true; } @Function(title = "wffuncdemo.checkmember.title", description = "wffuncdemo.checkmember.description", category = "wf_branch_function") public static boolean checkMember(String member, int month) { System.out.println("人员" + member + " " + month + "全勤"); return true; } }
方法上添加Function注解,声明当前方法是自定义函数。 |
|
在函数列表中显示的标题的国际化资源的key。 |
|
在函数列表中显示的函数描述国际化资源的key。 |
|
固定使用wf_branch_function,表明用于工作流分支。 |
|
函数的名称,使用方法名称,工作流分支自定义函数要求是返回值为boolean型的静态方法。 |

注意:只有部署了自定义函数的环境,分支函数对话框才会出现“自定义函数”,请参照示例代码。