动态制定审批人

This commit is contained in:
zhangzhiguo 2024-12-10 14:54:02 +08:00
parent b195128499
commit d597a997da
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package zcgj.zcdev.zcdev.pr.plugin.workflow;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.workflow.api.AgentExecution;
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
import java.util.ArrayList;
import java.util.List;
/**
* 支出合同动态设置某个节点审批人
*/
public class DynamicSetPMApprovalFlowPlugin implements IWorkflowPlugin {
//根据经理制定当前节点的审批人
@Override
public List<Long> calcUserIds(AgentExecution execution) {
List<Long> ApproversIdList = new ArrayList<>();
// 获取单据id
String pkId = execution.getBusinessKey();
// 获取单据体中的经理字段将用户设置为当前单据的当前节点的审批人
DynamicObject obj = BusinessDataServiceHelper.loadSingle(pkId, "zcgj_test_work_bill");
DynamicObject zcgjManger = obj.getDynamicObject("zcgj_manger");
long userId = zcgjManger.getLong("id");
ApproversIdList.add(userId);
// 返回审批人的id集合
return ApproversIdList;
}
}