From 04b2c46dfb51cb14a5586c4c8d5f8af43bd0c461 Mon Sep 17 00:00:00 2001 From: yuxueliang0813 <407010292@qq.com> Date: Tue, 18 Mar 2025 18:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E8=B4=A6=E6=98=8E=E7=BB=86=E5=8D=95-?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=88=9B=E5=BB=BA=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ClearDetailBillListPlugin.java | 6 +-- .../operate/ClearAccountBillOperation.java | 16 ++++++- .../plugin/operate/IntBillBatchOperation.java | 44 +++++++++++++++++++ 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailBillListPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailBillListPlugin.java index 793ad5e..ed307a9 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailBillListPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailBillListPlugin.java @@ -40,14 +40,14 @@ public class ClearDetailBillListPlugin extends AbstractListPlugin implements Plu @Override public void initialize() { - //表单视图模型初始化,创建插件后,触发此事件 + //表单视图模型初始化,创建插件后,触发此事件(刷新按钮和字段过滤都会触发) super.initialize(); - setArRole(); } @Override public void afterCreateNewData(EventObject e) { - //界面初始化或刷新,新建数据包完毕后,触发此事件 + //界面初始化,新建数据包完毕后,触发此事件(刷新按钮不会触发) super.afterCreateNewData(e); + setArRole(); } } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java index 67bc44b..4a06bbb 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearAccountBillOperation.java @@ -3,6 +3,7 @@ package shjh.jhzj7.fi.fi.plugin.operate; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.sap.db.jdbc.packet.ErrorLevel; +import kd.bos.coderule.api.CodeRuleInfo; import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -16,6 +17,7 @@ import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.coderule.CodeRuleServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.sdk.plugin.Plugin; import shjh.jhzj7.fi.fi.utils.JhzjUtils; @@ -252,7 +254,9 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im private DynamicObject newDetailBill(DynamicObject prinfo, DynamicObject userinfo) { //根据清账单和被通知人创建清账明细单 DynamicObject detailinfo = BusinessDataServiceHelper.newDynamicObject(entityName); - detailinfo.set("billno", prinfo.getString("billno"));//单据编号 + CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(entityName, detailinfo, null); + String number = CodeRuleServiceHelper.getNumber(codeRule, detailinfo); + detailinfo.set("billno", number);//单据编号 detailinfo.set("org", prinfo.getDynamicObject("org"));//公司 detailinfo.set("shjh_currency", prinfo.getDynamicObject("shjh_currency"));//币别 detailinfo.set("shjh_bizdate", prinfo.getDate("shjh_bizdate"));//业务日期 @@ -361,7 +365,10 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im destinfo.set("shjh_receamount", srcinfo.getBigDecimal("shjh_receamount"));//收款金额 destinfo.set("shjh_bizbig", srcinfo.getDynamicObject("shjh_bizbig"));//业务大类 destinfo.set("shjh_bizsmall", srcinfo.getDynamicObject("shjh_bizsmall"));//业务小类 - + //处理单据编码规则 + CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(srcinfo.getDataEntityType().getName(), destinfo, null); + String number = CodeRuleServiceHelper.getNumber(codeRule, destinfo); + destinfo.set("billno", number);//单据编号 //新清账单需处理的字段为:业务日期为源清账单的反清账日期;单据状态=暂存;清账日期=业务日期,可修改;清账状态=待清账;已认领收款金额=0; //未认领收款金额=收款金额;源清账单号=被复制的清账单单号;【是否被复制】=否 destinfo.set("shjh_bizdate", srcinfo.getDate("shjh_uncleardate"));//业务日期 @@ -372,6 +379,11 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im destinfo.set("shjh_unclaimamount", srcinfo.getBigDecimal("shjh_receamount"));//未认领收款金额=收款金额 destinfo.set("shjh_srcbillno", srcinfo.getString("billno"));//源清账单号=被复制的清账单单号 + destinfo.set("creator", srcinfo.getDynamicObject("creator"));//创建人 + destinfo.set("createtime", new Date());//创建时间 + destinfo.set("modifier", srcinfo.getDynamicObject("modifier"));//修改人 + destinfo.set("modifytime", new Date());//修改时间 + SaveServiceHelper.save(new DynamicObject[]{destinfo}); //原清账单:【是否被复制】=是 DB.update(DBRoute.of("fi"), updateSrcClear, new Object[]{srcinfo.getLong("id")}); diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java new file mode 100644 index 0000000..5a14dae --- /dev/null +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/IntBillBatchOperation.java @@ -0,0 +1,44 @@ +package shjh.jhzj7.fi.fi.plugin.operate; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.db.DB; +import kd.bos.db.DBRoute; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; + +/** + * 理财收益批量预提-单据操作插件 + * @author yuxueliang + */ +public class IntBillBatchOperation extends AbstractOperationServicePlugIn implements Plugin { + + private static final String destName = "cim_intbill_reve";//预提记账处理 + private static final String updateVoucher = "update t_cim_revenue set fk_shjh_needvoucher=1 where fid=?;"; + + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + String eok = e.getOperationKey(); + if("audit".equals(eok)){ + DynamicObject[] dos = e.getDataEntities(); + DynamicObject prinfo;//理财收益批量预提单 + DynamicObject destinfo;//预提记账处理单 + QFilter qFilter; + 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")}); + } + } + } + } + } +}