52 lines
2.0 KiB
Java
52 lines
2.0 KiB
Java
package shkd.repc.iwork;
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.logging.Log;
|
|
import kd.bos.logging.LogFactory;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.workflow.api.AgentExecution;
|
|
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
|
|
|
|
import java.util.List;
|
|
|
|
import static shkd.repc.iwork.IWorkParticipantPlugin.addApprover;
|
|
|
|
/**
|
|
* 设置流程参与人插件
|
|
*/
|
|
public class IWorkParticipantsPlugin implements IWorkflowPlugin {
|
|
|
|
private static final Log logger = LogFactory.getLog(IWorkParticipantsPlugin.class);
|
|
|
|
//recon_payreqbill(付款申请)-资金出纳
|
|
@Override
|
|
public List<Long> calcUserIds(AgentExecution execution) {
|
|
List<Long> currentApprover = execution.getCurrentApprover(); // 获取当前节点的审批人
|
|
|
|
String businessKey = execution.getBusinessKey(); // 单据的BusinessKey(业务ID)
|
|
String entityNumber = execution.getEntityNumber(); // 单据实体编码
|
|
DynamicObject entity = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber);
|
|
|
|
if (entity != null) {
|
|
// 处理未定义的实体编码的情况(可选)
|
|
if ("recon_payreqbill".equals(entityNumber)) {
|
|
handlePayReqBill(entity, currentApprover);
|
|
}
|
|
}
|
|
|
|
return currentApprover;
|
|
}
|
|
|
|
private void handlePayReqBill(DynamicObject entity, List<Long> currentApprover) {
|
|
DynamicObject contractbill = entity.getDynamicObject("contractbill"); // 付款申请_获取选择的合同
|
|
if (contractbill != null) {
|
|
contractbill = BusinessDataServiceHelper.loadSingle(contractbill.getPkValue(), "recon_contractbill");
|
|
// String partyatype1 = contractbill.getString("partyatype"); // 甲方类别
|
|
// if ("qeug_recon_developer".equals(partyatype1)) {
|
|
DynamicObject dynamicObject = contractbill.getDynamicObject("multitypepartya"); // 甲方
|
|
addApprover(currentApprover, dynamicObject, "qeug_userfield1", "资金出纳");
|
|
// }
|
|
}
|
|
}
|
|
}
|