1.费用登记根据用款部门携带财务组织

2.工作流设置流程参与人插件优化

S
This commit is contained in:
weiyunlong 2024-12-18 15:23:01 +08:00
parent 47cb24fb2d
commit 5b6f7fe129
3 changed files with 88 additions and 4 deletions

View File

@ -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<Long> currentApprover, DynamicObject dynamicObject, String field, String role) {
public static void addApprover(List<Long> currentApprover, DynamicObject dynamicObject, String field, String role) {
if (dynamicObject != null) {
dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), "qeug_recon_developer");
DynamicObject approver = dynamicObject.getDynamicObject(field);

View File

@ -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<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", "资金出纳");
}
}
}
}

View File

@ -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) {
// 采购项目