• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

Process Extension:Summary of Custom Function Example Codes for Workflow Extension


I. Workflow Node Approver Function

In business process handling, custom functions for handover, cc, additional signature, filling, and notifiers are included. When the default approver selection mechanism provided by the platform cannot meet personalized business requirements, we can use custom functions to specifically process the generation logic of approvers.

(Ⅰ) Writing a Custom Approver Function

@Function(openLevel = {FunctionOpenEnum.API})
@Function.Advanced(type = FunctionTypeEnum.QUERY, displayName = "Reimbursement Form - Certifier - Approval", category = CUSTOM_DESIGNER)
public List<NodePerson> bizZmrApprovePerson(List<NodePerson> nodePersonList, NodeModel nodeModel, WorkflowContext workflowContext) {
    List<NodePerson> newNodePersonList = new ArrayList<>();
    String nodeModelId = nodeModel.getId();
    Object nodeData = workflowContext.get(nodeModelId);
    BuissModel inputBuissModel = JsonUtils.parseObject(JsonUtils.toJSONString(nodeData), BUISSMODEL_TR);
    BuissModel buissModel = new BuissModel().setId(inputBuissModel.getId()).queryById();
    buissModel.fieldQuery(BuissModel::getZmEmployee);
    BxEmployee zmEmployee = buissModel.getZmEmployee();
    if (zmEmployee == null) {
        log.error("Reimbursement form ID:{}, name:{}, certifier is empty", buissModel.getId(), buissModel.getName());
        return newNodePersonList;
    }
    NodePersonUser personUser = new NodePersonUser();
    List<NodePersonUser> nodePersonUsers = new ArrayList<>();
    NodePerson person = new NodePerson();
    person.setId(zmEmployee.getBindingUserId() + "");
    person.setType(NodePersonTypeEnum.USER); 
    personUser.setUserId(zmEmployee.getBindingUserId());
    nodePersonUsers.add(personUser);
    person.setNodePersonUsers(nodePersonUsers);
    newNodePersonList.add(person);

    return newNodePersonList;
}

(Ⅱ) Setting Custom Function for Approval Node in Process Designer

II. Function Executed Before Approval Starts

Usage scenario: When custom logic processing is required during the initialization of an approval or filling node task before the task starts Execution time: This extension is executed after the initialization of the approval or filling to-do task and before the execution of the approval or filling result

/**
 * Execute pre-function after approval node initialization is completed
 * @param approvalNode
 * @param context
 * @param taskInstance
 */
@Function(name = "approvalCustomStartFun",openLevel = FunctionOpenEnum.API)
@Function.Advanced(type= FunctionTypeEnum.QUERY,displayName = "Pre-processing for Approval Execution",category = FunctionCategoryEnum.CUSTOM_DESIGNER )
public void approvalCustomStartFun(ApprovalNode approvalNode, WorkflowContext context, WorkflowTaskInstance taskInstance) {
    // TODO: 2024/2/23 Custom business logic processing can be added as needed
}

III. Function Executed Before Filling

/**
* Pre-processing for filling execution
*/
@Function(name = "writeCustomStartFun", openLevel = FunctionOpenEnum.API)
@Function.Advanced(type = FunctionTypeEnum.QUERY, displayName = "Pre-processing for Filling Execution", category = FunctionCategoryEnum.CUSTOM_DESIGNER)
public void writeCustomStartFun(WorkflowTaskInstance taskInstance, WriteNode writeNode, WorkflowContext context) {
    System.out.println("Pre-processing for filling execution");
}

IV. Function Executed After Submitting To-Do Operations

Usage scenario: When additional logic needs to be executed during the operation of an approval or filling to-do task, such as updating database records related to the current user's operation after submission Execution time: This extension is executed after saving the to-do task and before asynchronously executing the approval or filling result

/**
 * Post-handover operation function, selected in the extension settings of approval and filling nodes in the process designer - function executed after filling operation submission
 * @param userTask User to-do record
 * @return To-do record
 */
@Function(name = "transformOrgSelectEndFun",openLevel = FunctionOpenEnum.API)
@Function.Advanced(type= FunctionTypeEnum.QUERY,displayName = "Post-handover Operation Function",category = FunctionCategoryEnum.CUSTOM_DESIGNER )
public WorkflowUserTask transformOrgSelectEndFun(WorkflowUserTask userTask) {
// Filter by operation type
// After handover operation
if (!WorkflowUserTaskOperateTypeEnum.APPROVE_TRANGER.equals(userTask.getOperateType())) {
    return userTask;
}
// TODO: 2023/11/21 Custom business logic can be added, with userTask data corresponding to the submitted T data

// In case of approval agreement
if (WorkflowUserTaskOperateTypeEnum.APPROVE_AGREE.equals(userTask.getOperateType())) {
    // TODO
}

// In case of approval rejection
if (WorkflowUserTaskOperateTypeEnum.APPROVE_REJUST.equals(userTask.getOperateType())) {
    // TODO
}

return userTask;
}

V. Approval Operation Data Function

Usage scenario: When additional changes to other business data logic are required during approval or filling execution (e.g., modifying associated data status after approval agreement) Execution time: This extension is executed after the business data is saved following approval agreement or filling submission during approval or filling execution

/**
 * Data processing after approval
 * @param approvalNode Approval node
 * @param context Context
 * @param dataJson Submitted approval data
 * @param result Approval result
 */
@Function(name = "approvalDataProcessFun",openLevel = FunctionOpenEnum.API)
@Function.Advanced(type= FunctionTypeEnum.QUERY,displayName = "Data Processing After Approval",category = FunctionCategoryEnum.CUSTOM_DESIGNER )
public void approvalDataProcessFun(ApprovalNode approvalNode, WorkflowContext context, String dataJson, Boolean result) {
    // Content of submitted approval data
    Map<String, Object> data = JsonUtils.parseMap(dataJson);
    Long id = ParamUtils.createLong(data.get("id"));
    // Process custom data based on approval result - approved
    if(result != null && result){
        // TODO: 2024/2/23 Custom business logic processing can be added based on the result
    }


    // Rejected
    if(result != null && !result){
        // TODO: 2024/2/23 Custom business logic processing can be added based on the result
    }
}
Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Process expansion:Operate the workflow through business data (such as urging, canceling, etc.)
Next
Process Configuration:Workflow Introduction and Process Triggering in Projects
默认页脚
Copyright © 2026 Mr.Hope