From 5b6f7fe12948b8e06352a4ef67dc4466d401f231 Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Wed, 18 Dec 2024 15:23:01 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B4=B9=E7=94=A8=E7=99=BB=E8=AE=B0=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=94=A8=E6=AC=BE=E9=83=A8=E9=97=A8=E6=90=BA=E5=B8=A6?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=BB=84=E7=BB=87=202.=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E8=AE=BE=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E4=BA=BA=E6=8F=92=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit S --- .../repc/iwork/IWorkParticipantPlugin.java | 6 +-- .../repc/iwork/IWorkParticipantsPlugin.java | 51 +++++++++++++++++++ .../ReconPayreqProjectFormPlugin.java | 35 +++++++++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 main/java/shkd/repc/iwork/IWorkParticipantsPlugin.java 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) { // 采购项目