From 31f7ebf78d2996701594023bf3d84dedb5e85ebc Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Fri, 1 Aug 2025 14:05:15 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E7=94=B3=E8=AF=B7=E4=BA=BA=E9=9C=80=E4=B8=8E=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E7=9A=84=E6=94=B6=E6=AC=BE=E4=BF=A1=E6=81=AF=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=94=B6=E6=AC=BE=E4=BA=BA=E4=B8=80=E8=87=B4=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fs/plugin/operate/DailyReimbursSubOp.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyReimbursSubOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyReimbursSubOp.java index e857737..e894e28 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyReimbursSubOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyReimbursSubOp.java @@ -48,19 +48,26 @@ public class DailyReimbursSubOp extends AbstractOperationServicePlugIn { for (DynamicObject accountEntry : accountEntryCollection) { String payerType = accountEntry.getString("payertype");//收款人类型 if (payerType.equals("er_payeer")) { - DynamicObject payer = accountEntry.getDynamicObject("payer");//收款人(个人 - if (payer != null && applier != null) { - String applierNumber = applier.getString("number");//申请人编号 - DynamicObject payer1 = payer.getDynamicObject("payer");//收款人(个人-收款人 - if (payer1 == null) { - return; - } - String payer1Number = payer1.getString("number");//收款人编号 - if (!applierNumber.equals(payer1Number) && "".equals(zcgj_invoiceremark)) { - //申请人和收款人不一致 + String payerName = accountEntry.getString("payername");//收款人名称 + if (!"".equals(payerName) && applier != null){ + String applierName = applier.getString("name");//申请人名称 + if (!applierName.equals(payerName) && "".equals(zcgj_invoiceremark)) { this.addFatalErrorMessage(extendedDataEntity, "收款人与申请人不一致!请填写特殊说明!"); } } +// DynamicObject payer = accountEntry.getDynamicObject("payer");//收款人(个人 +// this.addFatalErrorMessage(extendedDataEntity, "收款人与申请人不一致!请填写特殊说明!"); +// if (payer != null && applier != null) { +// String applierName = applier.getString("name");//申请人编号 +// DynamicObject payer1 = payer.getDynamicObject("payer");//收款人(个人-收款人 +// if (payer1 == null) { +// return; +// } +// String payer1Number = payer1.getString("number");//收款人编号 +// if (!applierName.equals(payer1Number) && "".equals(zcgj_invoiceremark)) { +// //申请人和收款人不一致 +// } +// } } } } From 846145ee2f23ca37160dd71fe9b48a2ea51bee2f Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Mon, 4 Aug 2025 13:54:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E3=80=81=E5=B7=AE=E6=97=85=E6=8A=A5=E9=94=80=E5=8D=95?= =?UTF-8?q?=E3=80=81=E5=AF=B9=E5=85=AC=E6=8A=A5=E9=94=80=E5=8D=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=93=8D=E4=BD=9C=E6=8F=92=E4=BB=B6=EF=BC=9A=E5=BC=80?= =?UTF-8?q?=E7=A5=A8=E6=97=A5=E6=9C=9F=E4=B8=8E=E5=BD=93=E5=89=8D=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E7=9A=84=E5=AF=B9=E6=AF=94=E6=A0=A1=E9=AA=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/InvoiceDateValidatorSubOp.java | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java new file mode 100644 index 0000000..5dc4af3 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java @@ -0,0 +1,106 @@ +package zcgj.zcdev.zcdev.fs.plugin.operate; + +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 zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.TimeUnit; + +/** + * 使用单据:费用报销单、差旅报销单、对公报销单提交操作插件 + * 校验逻辑:开票日期与当前日期的对比校验 + */ +public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("costcompany");//费用承担公司 + e.getFieldKeys().add("zcgj_invoiceremark");//特殊说明 + e.getFieldKeys().add("invoiceentry");//发票信息分录 + e.getFieldKeys().add("invoicedate");//开票日期 + } + + @Override + public void onAddValidators(AddValidatorsEventArgs e) { + super.onAddValidators(e); + e.getValidators().add(new ValidatorExt()); + } + + static class ValidatorExt extends AbstractValidator { + @Override + public void validate() { + ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); + 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)) { + //仅针对矿山下组织下的逻辑 + String invoiceRemark = dataEntity.getString("zcgj_invoiceremark");//特殊说明 + DynamicObjectCollection invoiceEntryCollection = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息分录 + if (invoiceEntryCollection.size() > 0) { + //存在发票分录时才进行下列校验 + for (int i = 0; i < invoiceEntryCollection.size(); i++) { + DynamicObject invoiceEntry = invoiceEntryCollection.get(i); + int i1 = i + 1; + Date currentDate = new Date();//当前日期 + Date invoiceDate = invoiceEntry.getDate("invoicedate");//开票日期 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date currentDateFormat = sdf.parse(sdf.format(currentDate));//当前日期 + Date invoiceDateFormat = sdf.parse(sdf.format(invoiceDate));//开票日期 + + // 校验1: 开票日期不能大于当前日期 + if (invoiceDate.after(currentDateFormat)) { + this.addFatalErrorMessage(extendedDataEntity, "第" + i1 + "行,开票日期大于当前日期!"); + return; + } + + // 校验2: 当前日期减去开票日期不能大于30天 + long diffInMillies = Math.abs(currentDateFormat.getTime() - invoiceDateFormat.getTime()); + long diffInDays = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); + + // 校验3:如果发票是去年12月开具,且当前是今年1月31日前,则视为合规 + boolean isSpecialCase = false; + java.util.Calendar currentCal = java.util.Calendar.getInstance(); + currentCal.setTime(currentDate); + int currentYear = currentCal.get(java.util.Calendar.YEAR);//当前年份 + int currentMonth = currentCal.get(java.util.Calendar.MONTH);//当前月份 + int currentDay = currentCal.get(java.util.Calendar.DAY_OF_MONTH);//当前日期 + java.util.Calendar invoiceCal = java.util.Calendar.getInstance(); + invoiceCal.setTime(invoiceDate); + int invoiceYear = invoiceCal.get(java.util.Calendar.YEAR);//发票年份 + int invoiceMonth = invoiceCal.get(java.util.Calendar.MONTH);//发票月份 + // 判断是否为特殊情况:发票为去年12月,当前为今年1月且日期<=31日的视为合理 + if (currentYear - invoiceYear == 1 && + invoiceMonth == java.util.Calendar.DECEMBER && + currentMonth == java.util.Calendar.JANUARY && + currentDay <= 31) { + isSpecialCase = true; + } + + // 最终校验:当前日期减去开票日期不能大于30天且不是特殊情况且特殊说明为空时,则视为不合规 + if (diffInDays > 30 && !isSpecialCase && "".equals(invoiceRemark)) { + this.addFatalErrorMessage(extendedDataEntity, "第" + i1 + "行,发票开具日期至当前报销日的间隔时间,不得超过一个月(30天)。必须填写特殊说明才能提交!"); + return; + } + } catch (ParseException e) { + return; + } + } + } + } + } + } + } + } +} From 0138cbf94ae2d8a379e3bd7b321cde8f95b4963c Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Mon, 4 Aug 2025 13:56:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java index 5dc4af3..8837d6d 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java @@ -34,7 +34,7 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { e.getValidators().add(new ValidatorExt()); } - static class ValidatorExt extends AbstractValidator { + class ValidatorExt extends AbstractValidator { @Override public void validate() { ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); From 8962e95bac2935c6e23813e6339a8adff5dd5a5f Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Mon, 4 Aug 2025 16:15:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AF=B9=E5=85=AC=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E6=8F=90=E4=BA=A4=E6=93=8D=E4=BD=9C=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=9A=E5=86=B2=E9=A2=84=E4=BB=98=E6=97=B6=E9=A2=84=E4=BB=98?= =?UTF-8?q?=E5=8D=95=E6=94=AF=E4=BB=98=E6=97=A5=E6=9C=9F=E4=B8=8E=E5=BC=80?= =?UTF-8?q?=E7=A5=A8=E6=97=A5=E6=9C=9F=E5=92=8C=E5=BD=93=E5=89=8D=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E7=9A=84=E5=AF=B9=E6=AF=94=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/InvoiceDateValidatorSubOp.java | 73 +++++++++++++++++-- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java index 8837d6d..e4c1f2a 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java @@ -7,6 +7,9 @@ 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.BusinessDataServiceHelper; import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils; import java.text.ParseException; @@ -15,8 +18,8 @@ import java.util.Date; import java.util.concurrent.TimeUnit; /** - * 使用单据:费用报销单、差旅报销单、对公报销单提交操作插件 - * 校验逻辑:开票日期与当前日期的对比校验 + * 1:校验逻辑:开票日期与当前日期的对比校验 → 使用单据:费用报销单、差旅报销单、对公报销单提交操作; + * 2:校验逻辑:冲预付时预付单支付日期与开票日期和当前日期的对比校验 → 使用单据:对公报销单提交操作。 */ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { @Override @@ -26,6 +29,9 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { e.getFieldKeys().add("zcgj_invoiceremark");//特殊说明 e.getFieldKeys().add("invoiceentry");//发票信息分录 e.getFieldKeys().add("invoicedate");//开票日期 + e.getFieldKeys().add("writeoffmoney");//冲预付/借款分录 + e.getFieldKeys().add("srcbilltype");//来源单据类型 + e.getFieldKeys().add("loanbillnov1");//冲预付编码 } @Override @@ -45,6 +51,7 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { Long companyId = costCompany.getLong("id"); if (OrgCheckUtils.isKS(companyId)) { //仅针对矿山下组织下的逻辑 + String dataEntityTypeName = dataEntity.getDataEntityType().getName(); String invoiceRemark = dataEntity.getString("zcgj_invoiceremark");//特殊说明 DynamicObjectCollection invoiceEntryCollection = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息分录 if (invoiceEntryCollection.size() > 0) { @@ -52,7 +59,8 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { for (int i = 0; i < invoiceEntryCollection.size(); i++) { DynamicObject invoiceEntry = invoiceEntryCollection.get(i); int i1 = i + 1; - Date currentDate = new Date();//当前日期 +// Date currentDate = new Date();//当前日期 + Date currentDate = invoiceEntry.getDate("zcgj_invoicedate");//当前日期 Date invoiceDate = invoiceEntry.getDate("invoicedate");//开票日期 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { @@ -61,7 +69,7 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { // 校验1: 开票日期不能大于当前日期 if (invoiceDate.after(currentDateFormat)) { - this.addFatalErrorMessage(extendedDataEntity, "第" + i1 + "行,开票日期大于当前日期!"); + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行:开票日期大于当前日期!"); return; } @@ -90,12 +98,67 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { // 最终校验:当前日期减去开票日期不能大于30天且不是特殊情况且特殊说明为空时,则视为不合规 if (diffInDays > 30 && !isSpecialCase && "".equals(invoiceRemark)) { - this.addFatalErrorMessage(extendedDataEntity, "第" + i1 + "行,发票开具日期至当前报销日的间隔时间,不得超过一个月(30天)。必须填写特殊说明才能提交!"); + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行:发票开具日期至当前报销日的间隔时间,不得超过一个月(30天)。必须填写特殊说明才能提交!"); return; } } catch (ParseException e) { return; } + // 对公报销单冲预付单独校验逻辑 + if (dataEntityTypeName.equals("er_publicreimbursebill")) { + // 对公报销单 + DynamicObjectCollection writeOffMoneyCollection = dataEntity.getDynamicObjectCollection("writeoffmoney");//冲预付/借款分录 + if (writeOffMoneyCollection.size() > 0) { + for (int j = 0; j < writeOffMoneyCollection.size(); j++) { + int j1 = j + 1; + DynamicObject writeOffMoney = writeOffMoneyCollection.get(j); + String srcBillType = writeOffMoney.getString("srcbilltype");//冲预付分录-源单据类型 + if (srcBillType.equals("er_prepaybill")) { + //冲预付 + String loanBillNov1 = writeOffMoney.getString("loanbillnov1");//冲预付分录-单据编码 + QFilter[] qFilter = new QFilter[]{new QFilter("billno", QCP.equals, loanBillNov1)}; + DynamicObject er_prepayBill = BusinessDataServiceHelper.loadSingle("er_prepaybill", + "id,head_paydate", qFilter);//预付单 + Date head_payDate = er_prepayBill.getDate("head_paydate");//预付单-付款日期 + if (head_payDate != null) { + try { + Date currentDateFormat = sdf.parse(sdf.format(currentDate));//当前日期 + Date invoiceDateFormat = sdf.parse(sdf.format(invoiceDate));//开票日期 + Date headPayDateFormat = sdf.parse(sdf.format(head_payDate));//预付单付款日期 + + // 校验1:付款日期不能大于当前日期或者开票日期 + if (headPayDateFormat.after(currentDateFormat)) { + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行与冲预付/借款分录第" + j1 + "行:预付单付款日期不能大于当前日期!"); + return; + } + if (headPayDateFormat.after(invoiceDateFormat)) { + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行与冲预付/借款分录第" + j1 + "行:预付单付款日期不能大于发票开票日期!"); + return; + } + + // 校验2: 发票开具时间减去预付单的付款日期,必须小于等于15天 + long diffInvoiceToPayMillis = Math.abs(invoiceDateFormat.getTime() - headPayDateFormat.getTime()); + long diffInvoiceToPayDays = TimeUnit.DAYS.convert(diffInvoiceToPayMillis, TimeUnit.MILLISECONDS); + if (diffInvoiceToPayDays > 15 && "".equals(invoiceRemark)) { + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行与冲预付/借款分录第" + j1 + "行:发票开具日期至预付单的支付时间的间隔,不得超过15天。必须填写特殊说明才能提交"); + return; + } + + // 校验3: 当前时间减去预付单的付款日期,必须小于等于30天 + long diffCurrentToPayMillis = Math.abs(currentDateFormat.getTime() - headPayDateFormat.getTime()); + long diffCurrentToPayDays = TimeUnit.DAYS.convert(diffCurrentToPayMillis, TimeUnit.MILLISECONDS); + if (diffCurrentToPayDays > 30 && "".equals(invoiceRemark)) { + this.addFatalErrorMessage(extendedDataEntity, "发票信息第" + i1 + "行与冲预付/借款分录第" + j1 + "行:预付款支付日期至当前报销日的间隔时间,不得超过30天。必须填写特殊说明才能提交"); + return; + } + } catch (ParseException e) { + return; + } + } + } + } + } + } } } } From d708326083b06d9d33b22e23da864c0ab707b3e7 Mon Sep 17 00:00:00 2001 From: xuhaihui <2098865055@qq.com> Date: Mon, 4 Aug 2025 16:31:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java index e4c1f2a..3d73bb9 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/InvoiceDateValidatorSubOp.java @@ -59,8 +59,8 @@ public class InvoiceDateValidatorSubOp extends AbstractOperationServicePlugIn { for (int i = 0; i < invoiceEntryCollection.size(); i++) { DynamicObject invoiceEntry = invoiceEntryCollection.get(i); int i1 = i + 1; -// Date currentDate = new Date();//当前日期 - Date currentDate = invoiceEntry.getDate("zcgj_invoicedate");//当前日期 + Date currentDate = new Date();//当前日期 +// Date currentDate = invoiceEntry.getDate("zcgj_invoicedate");//当前日期 Date invoiceDate = invoiceEntry.getDate("invoicedate");//开票日期 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try {