diff --git a/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java b/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java index 6faecf0..220e085 100644 --- a/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java +++ b/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java @@ -22,7 +22,7 @@ public class IWorkParticipantPlugin implements IWorkflowPlugin { /** * recon_contractbill(合同)-印章管理员 - * recon_payreqbill(付款申请)-资金出纳和园区会计 + * recon_payreqbill(付款申请)-园区会计 * recon_designchgbill(涉及变更) 供应商:designunit(设计单位) * recon_chgauditorderbill(工程指令) 供应商:construnit(施工单位) * recon_rewarddeductbill(奖励扣款) 供应商存在分录:rewarddeductentry(奖惩单分录) 供应商:entry_supplier(供应商) @@ -146,13 +146,11 @@ public class IWorkParticipantPlugin implements IWorkflowPlugin { if ("qeug_recon_developer".equals(partyatype1)) { DynamicObject dynamicObject = contractbill.getDynamicObject("multitypepartya"); // 甲方 addApprover(currentApprover, dynamicObject, "qeug_userfield", "园区会计"); - addApprover(currentApprover, dynamicObject, "qeug_userfield1", "资金出纳"); - } } } - private void addApprover(List currentApprover, DynamicObject dynamicObject, String field, String role) { + public static void addApprover(List currentApprover, DynamicObject dynamicObject, String field, String role) { if (dynamicObject != null) { dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), "qeug_recon_developer"); DynamicObject approver = dynamicObject.getDynamicObject(field); diff --git a/main/java/shkd/repc/iwork/IWorkParticipantsPlugin.java b/main/java/shkd/repc/iwork/IWorkParticipantsPlugin.java new file mode 100644 index 0000000..77f0ae1 --- /dev/null +++ b/main/java/shkd/repc/iwork/IWorkParticipantsPlugin.java @@ -0,0 +1,51 @@ +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 calcUserIds(AgentExecution execution) { + List 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 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", "资金出纳"); + } + } + } +} diff --git a/main/java/shkd/repc/recon/formplugin/ReconPayreqProjectFormPlugin.java b/main/java/shkd/repc/recon/formplugin/ReconPayreqProjectFormPlugin.java index b46fab7..8f20919 100644 --- a/main/java/shkd/repc/recon/formplugin/ReconPayreqProjectFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ReconPayreqProjectFormPlugin.java @@ -16,6 +16,8 @@ public class ReconPayreqProjectFormPlugin extends AbstractBillPlugIn { super.afterBindData(e); //根据组织携带项目 updateRenovationProject(); + //费用登记根据用款部门携带财务组织 + updateFinanceOrg(); } @Override @@ -26,6 +28,10 @@ public class ReconPayreqProjectFormPlugin extends AbstractBillPlugIn { if ("org".equals(name)) { updateRenovationProject(); } + //费用登记根据用款部门携带财务组织 + if ("usedepart".equals(name)) { + updateFinanceOrg(); + } } private void updateRenovationProject() { @@ -40,6 +46,35 @@ public class ReconPayreqProjectFormPlugin extends AbstractBillPlugIn { this.getView().updateView("project"); } } + private void updateFinanceOrg() { + DynamicObject usedepart = (DynamicObject) this.getModel().getValue("usedepart"); + if (usedepart != null) { + setRenovationFinanceByOrg(usedepart); + } else { + // 组织为空,清空项目 + this.getModel().setValue("qeug_jf", null); + this.getView().updateView("qeug_jf"); + } + } + + private void setRenovationFinanceByOrg(DynamicObject usedepart) { + usedepart = BusinessDataServiceHelper.loadSingle(usedepart.getPkValue(),"bos_org"); + DynamicObject qeug_recon_orgrelation = BusinessDataServiceHelper.loadSingle("qeug_recon_orgrelation", + new QFilter[]{new QFilter("number", QCP.equals, usedepart.getString("number"))}); + if (null != qeug_recon_orgrelation) { + //行政与财务组织对应关系 + qeug_recon_orgrelation = BusinessDataServiceHelper.loadSingle(qeug_recon_orgrelation.getPkValue(),"qeug_recon_orgrelation"); + //甲方 + DynamicObject qeug_recon_developer = BusinessDataServiceHelper.loadSingle("qeug_recon_developer", + new QFilter[]{new QFilter("number", QCP.equals, qeug_recon_orgrelation.getString("qeug_companynumber"))}); + if (null != qeug_recon_developer) { + // 设置项目并更新视图 + this.getModel().setValue("qeug_jf", qeug_recon_developer); + this.getView().updateView("qeug_jf"); + } + } + + } private void setRenovationProjectByOrg(DynamicObject org) { // 采购项目