diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/workflow/DynamicSetPMApprovalFlowPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/workflow/DynamicSetPMApprovalFlowPlugin.java new file mode 100644 index 0000000..6ef761e --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/workflow/DynamicSetPMApprovalFlowPlugin.java @@ -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 calcUserIds(AgentExecution execution) { + List 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; + } +}