From cf1566aa79682a616a35e777e5156633a8b8720d Mon Sep 17 00:00:00 2001 From: zhangzhiguo <421587375@qq.com> Date: Mon, 8 Sep 2025 10:48:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=AE=E6=97=85=E6=8A=A5=E9=94=80=E5=8D=95?= =?UTF-8?q?=E6=B1=BD=E8=BD=A6=E9=A3=9E=E6=9C=BA=E5=8F=91=E7=A5=A8=E4=B9=98?= =?UTF-8?q?=E8=BD=A6=E4=BA=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...TripreimbursebillIsInvoiceUserCheckOp.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceUserCheckOp.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceUserCheckOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceUserCheckOp.java new file mode 100644 index 0000000..09332e2 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillIsInvoiceUserCheckOp.java @@ -0,0 +1,85 @@ +package zcgj.zcdev.zcdev.fs.plugin.operate; + +import kd.bos.algo.DataSet; +import kd.bos.algo.Row; +import kd.bos.context.RequestContext; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.ExtendedDataEntity; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; +import kd.bos.entity.validate.AbstractValidator; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; +import kd.bos.util.StringUtils; +import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; + +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Month; +import java.time.ZoneId; +import java.time.temporal.TemporalAdjusters; +import java.util.*; + +/** + * 差旅报销单汽车、飞机发票乘车人和申请人校验 + */ +public class TripreimbursebillIsInvoiceUserCheckOp extends AbstractOperationServicePlugIn { + private static final String prefix ="zcgj"; + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("applier"); + e.getFieldKeys().add("invoiceentry"); + e.getFieldKeys().add("costcompany");//费用承担公司 + } + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.getValidators().add(new ValidatorExt()); + } + + class ValidatorExt extends AbstractValidator { + @Override + public void validate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM"); + ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); + Map> allMap = new HashMap<>(); + //当前提交的探亲单据id集合 + Map> currentBillIdListMap = new HashMap<>(); + + for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); + DynamicObject costCompany = dataEntity.getDynamicObject("costcompany");//费用承担公司 + if (costCompany != null) { + Long companyId = costCompany.getLong("id"); + if (OrgCheckUtils.isKS(companyId)) { + //获取报销人 + DynamicObject applier = dataEntity.getDynamicObject("applier"); + String applierName = applier.getString("name"); + DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("invoiceentry");//oa流程分录 + int i=1; + for (DynamicObject dynamicObject : tripentry) { + String invoicetype = dynamicObject.getString("invoicetype"); + if("9".equals(invoicetype) || "10".equals(invoicetype)){ + String passengername = dynamicObject.getString("passengername"); + if(!applierName.equals(passengername)){ + String message = String.format("发票信息第%d行,旅客和申请人不一致!",i); + this.addFatalErrorMessage(extendedDataEntity, message); + break; + } + } + i++; + } + } + } + } + } + } + +} +