文档中心 > API文档

1.6.6. 工作流分支自定义函数(Since:V5.6)

开发人员通过自定义函数在工作流分支原有的函数基础上进行扩展,完成预置函数不能完成的逻辑。

可从外部系统取数控制表单流程流转,比如可以在处理时实时从ERP取数决定流转的分支。

代码实现非常简单,定义任意类,加上相关注解,在Spring中注册即可

package com.seeyon.ctp.common.function.test;
 
 import com.seeyon.ctp.util.annotation.Function;
 
 public class ERPFunctions {
     @Function1(title = "wffuncdemo.checkbudget.title"2, description = "wffuncdemo.checkbudget.description"3, category = "wf_branch_function"4)
     public static boolean isBudgetAvailable5(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;
     }
 }

1

方法上添加Function注解,声明当前方法是自定义函数。

1

在函数列表中显示的标题的国际化资源的key。

1

在函数列表中显示的函数描述国际化资源的key。

1

固定使用wf_branch_function,表明用于工作流分支。

1

函数的名称,使用方法名称,工作流分支自定义函数要求是返回值为boolean型的静态方法。

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