# 操作者自定义Action开发说明

- 来源：https://weapp.eteams.cn/build/techdoc/wdoc/index.html#/public/doc/ec05807e-94f3-4459-98e6-ea75e5b5a0a7

一，操作者私有化客户可以通过写自定义开发的方式找人

![image.png](https://weapp.eteams.cn/api/file/preview?fileId=1055977667467157511&type=imgs)   说明：ecode注册事件名称是接口动作类文件配置作为event

二，钩子说明

| 构子名称 | 构子入参 | 钩子出参 |
| --- | --- | --- |
| 接口动作文件<br>例如: 上图配置的 - com.weaver.seconddev.bgy.cjy.workflow.operator.CustomOperatorInterface | requestInfo 请求相关信息<br>requestContext 已设置操作者，条件，系统变量相关上下文数据 | List<Long>   返回人员ID |

三， ecode接口钩子源码

![image.png](https://weapp.eteams.cn/api/file/preview?fileId=1055979454255325223&type=imgs)

四，参考代码

```java
package com.weaver.seconddev.bgy.cjy.workflow.operator;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.weaver.common.form.data.FormData;
import com.weaver.common.form.data.detail.FormDataDetail;
import com.weaver.ebuilder.form.common.utils.Util;
import com.weaver.loom.api.annotation.RegHook;
import com.weaver.loom.context.register.AbstractRegHookEvent;
import com.weaver.seconddev.bgy.cjy.util.SignatureUtils;
import com.weaver.seconddev.bgy.cjy.workflow.mapper.CustomOperatorMapper;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.workflow.common.entity.core.flow.RequestRuntimeDataEntity;
import com.weaver.workflow.common.entity.formdef.WfFieldValueEntity;
import com.weaver.workflow.common.entity.nodeoperator.OperatorSetEntity;
import com.weaver.workflow.common.entity.org.WeaUser;
import com.weaver.workflow.common.util.OrgUtil;
import com.weaver.workflow.core.api.rest.publicapi.WfcFormFieldRest;
import groovy.util.logging.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.weaver.framework.rpc.annotation.RpcReference;
import java.util.*;

@Slf4j
@RegHook(module = "workflow", event = "com.weaver.seconddev.bgy.cjy.workflow.operator.CustomOperatorInterface", order = 0)
public class CustomOperatorInterface extends AbstractRegHookEvent {
    Logger log = LoggerFactory.getLogger(CustomOperatorInterface.class);

    @RpcReference(group = "workflow")
    private WfcFormFieldRest wfcFormFieldRest;

    @Override
    public Object handle(Object[] args) throws Exception {

        RequestRuntimeDataEntity requestInfo = (RequestRuntimeDataEntity) args[0];
        Map<Long, List<WfFieldValueEntity>> requestContext = (Map<Long, List<WfFieldValueEntity>>) args[1];

        //获取流程requestId
        long requestId = requestInfo.getRequestId();

        //获取流程workflowId
        long workflowId = requestInfo.getWorkflowId();

        //获取表单数据
        FormData formData = wfcFormFieldRest.getFormDataByRequestId(requestId, simpleEmployee);

        //获取当前操作人
        WeaUser user = requestInfo.getUser();

        //最终返回操作人id列表
        List<Long> customOperators = new ArrayList<>();
        customOperators.add(100505410001433899l);
        customOperators.add(100505410001433913l);

        return customOperators;
    }

}
```

五，      ecode管理员登录OA系统，访问/ecode/monitor

六，     打jar文件，上传jar文件

说明： 1. ecode后端监控-部署-上传jar

2.选择流程二开服务有多少节点上传多少次

备注：如果ecode上传不了jar需要联系ecode模块处理。
