From 57d4c77696f2a4ef9eb02f72fca11dc66818aafa Mon Sep 17 00:00:00 2001 From: yuxueliang0813 <407010292@qq.com> Date: Wed, 19 Mar 2025 11:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=90=86=E8=B4=A2=E7=9B=B8=E5=85=B3=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/operate/IntBillBatchOperation.java | 13 ++-- .../plugin/operate/RevenueBillOperation.java | 62 +++++++++++++++++++ .../jhzj7/fi/fi/webapi/PersonControler.java | 10 +-- 3 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 main/java/shjh/jhzj7/fi/fi/plugin/operate/RevenueBillOperation.java diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java index 5a14dae..8ad8543 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java @@ -26,16 +26,19 @@ public class IntBillBatchOperation extends AbstractOperationServicePlugIn implem if("audit".equals(eok)){ DynamicObject[] dos = e.getDataEntities(); DynamicObject prinfo;//理财收益批量预提单 - DynamicObject destinfo;//预提记账处理单 - QFilter qFilter; +// DynamicObject destinfo;//预提记账处理单 + QFilter qFilter;//预提记账处理单集合 + DynamicObject[] ytjzdos; for (int i = 0; i < dos.length; i++) { prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName()); if(prinfo.getBoolean("shjh_needvoucher")){ //将此字段值携带至预提记账处理单中 intbatchbillid qFilter = new QFilter("intbatchbillid", QCP.equals, prinfo.getLong("id")); - destinfo = BusinessDataServiceHelper.loadSingle(destName,new QFilter[]{qFilter}); - if(destinfo != null){ - DB.update(DBRoute.of("fi"), updateVoucher, new Object[]{destinfo.getLong("id")}); + ytjzdos = BusinessDataServiceHelper.load(destName,"id",new QFilter[]{qFilter}); + if(ytjzdos != null){ + for (DynamicObject destinfo : ytjzdos){ + DB.update(DBRoute.of("fi"), updateVoucher, new Object[]{destinfo.getLong("id")}); + } } } } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RevenueBillOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RevenueBillOperation.java new file mode 100644 index 0000000..0289716 --- /dev/null +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RevenueBillOperation.java @@ -0,0 +1,62 @@ +package shjh.jhzj7.fi.fi.plugin.operate; + +import com.alibaba.fastjson.JSONObject; +import com.sap.db.jdbc.packet.ErrorLevel; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.db.DB; +import kd.bos.db.DBRoute; +import kd.bos.entity.operate.result.OperateErrorInfo; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; +import shjh.jhzj7.fi.fi.utils.SapUtils; + +/** + * 预提记账处理-单据操作插件 + * @author yuxueliang + */ +public class RevenueBillOperation extends AbstractOperationServicePlugIn implements Plugin { + + private static final String updateVoucherFlag = "update t_cim_revenue set fk_shjh_sendsap=1 where fid=?;"; + + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + String eok = e.getOperationKey(); + if("sendvoucher".equals(eok)){ + //推送sap凭证接口 + DynamicObject[] dos = e.getDataEntities(); + DynamicObject prinfo;//预提记账处理单 + JSONObject sapReturnData; + for (int i = 0; i < dos.length; i++) { + prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName()); + if(prinfo.getBoolean("shjh_needvoucher") && !prinfo.getBoolean("shjh_sendsap")){ + //TODO 如果预提记账处理单需要生成凭证且未推送sap的才推送sap + sapReturnData = sendVoucher(prinfo); + + if(sapReturnData != null && "0".equals(sapReturnData.getString("code"))){ + //推送sap成功后,反写已推送标记 + DB.update(DBRoute.of("fi"), updateVoucherFlag, new Object[]{prinfo.getPkValue()}); + this.operationResult.addSuccessPkId(prinfo.getPkValue()); + }else{ + addErrorInfo(prinfo,"推送SAP接口失败:"+sapReturnData.getString("msg")); + } + } + } + } + } + + private JSONObject sendVoucher(DynamicObject prinfo){ + //组装参数调用推送sap接口 + return null; + } + + private void addErrorInfo(DynamicObject bill, String errorMsg) { + OperateErrorInfo operateErrorInfo = new OperateErrorInfo(); + operateErrorInfo.setMessage(bill.getString("billno") + errorMsg); + operateErrorInfo.setErrorLevel(ErrorLevel.Error.name()); + operateErrorInfo.setPkValue(bill.getPkValue()); + this.operationResult.addErrorInfo(operateErrorInfo); + } +} diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/PersonControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/PersonControler.java index 91d1b09..4b68bc8 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/PersonControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/PersonControler.java @@ -116,10 +116,9 @@ public class PersonControler implements Serializable { oausername = json_body.getString("username");//OA用户名 emailPrefix = json_body.getString("emailPrefix");//邮箱前缀 fycc = json_body.getString("hpyp_cc_id");//费用成本中心 - + //去掉收款银行 详细分机银行 收款账号的为空校验 if(EsbUtils.isEmpty(number) || EsbUtils.isEmpty(name) || EsbUtils.isEmpty(deptid) || EsbUtils.isEmpty(email) - || EsbUtils.isEmpty(oausername) || EsbUtils.isEmpty(emailPrefix) || EsbUtils.isEmpty(fycc) || - EsbUtils.isEmpty(bank) || EsbUtils.isEmpty(bank_branch) || EsbUtils.isEmpty(bank_account)){ + || EsbUtils.isEmpty(oausername) || EsbUtils.isEmpty(emailPrefix) || EsbUtils.isEmpty(fycc)){ log.error(String.format("人员入参为空异常:%s", json_body.toJSONString())); itemInfo = new JSONObject(); itemInfo.put("code",number); @@ -279,10 +278,13 @@ public class PersonControler implements Serializable { String cusnumber = (String) ups.getDataMap().get("number");//客户编号-即是 人员的编号 DynamicObject currentCus = BusinessDataServiceHelper.loadSingle(cusEntityName,new QFilter[]{new QFilter("number","=",cusnumber)}); if(currentCus != null){ + String acctnum = (String) ups.getDataMap().get("shjh_acctnum");//收款账号 + if(EsbUtils.isEmpty(acctnum)){ + return; + } String cusname = (String) ups.getDataMap().get("name");//姓名 String skyh = (String) ups.getDataMap().get("shjh_skyh");//收款银行 String xxyh = (String) ups.getDataMap().get("shjh_xxyh");//详细分机银行 - String acctnum = (String) ups.getDataMap().get("shjh_acctnum");//收款账号 DynamicObjectCollection doc_bank = currentCus.getDynamicObjectCollection("entry_bank"); DynamicObject bankinfo; if(doc_bank.isEmpty()){