diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/EntCostSplitBillPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/EntCostSplitBillPlugin.java index d64416e..26e13e5 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/EntCostSplitBillPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/EntCostSplitBillPlugin.java @@ -259,19 +259,21 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn { Object costType1 = entry1.get("costtype"); Object costType2 = entry2.get("costtype"); - // 处理null值情况 - 将null值放在前面 if (costType1 == null && costType2 == null) return 0; - if (costType1 == null) return -1; // null值排在前面 - if (costType2 == null) return 1; // null值排在前面 + if (costType1 == null) return -1; + if (costType2 == null) return 1; - // 提取数值部分进行比较 - String value1 = costType1.toString().replaceAll("[^0-9]", ""); - String value2 = costType2.toString().replaceAll("[^0-9]", ""); + String str1 = costType1.toString().trim(); + String str2 = costType2.toString().trim(); - int num1 = value1.isEmpty() ? 0 : Integer.parseInt(value1); - int num2 = value2.isEmpty() ? 0 : Integer.parseInt(value2); + Integer sortValue1 = COST_TYPE_SORT_MAP.get(str1); + Integer sortValue2 = COST_TYPE_SORT_MAP.get(str2); - return Integer.compare(num1, num2); + if (sortValue1 == null && sortValue2 == null) return 0; + if (sortValue1 == null) return 1; + if (sortValue2 == null) return -1; + + return sortValue1.compareTo(sortValue2); }); // 按排序后的顺序添加数据 @@ -301,4 +303,19 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn { } } } + + private static final Map COST_TYPE_SORT_MAP = new HashMap<>(); + + static { + COST_TYPE_SORT_MAP.put("10.", 10); + COST_TYPE_SORT_MAP.put("20.", 20); + COST_TYPE_SORT_MAP.put("30.", 30); + COST_TYPE_SORT_MAP.put("40.", 40); + COST_TYPE_SORT_MAP.put("50.", 50); + COST_TYPE_SORT_MAP.put("60.", 60); + COST_TYPE_SORT_MAP.put("70.", 70); + COST_TYPE_SORT_MAP.put("80.", 80); + COST_TYPE_SORT_MAP.put("90.", 90); + COST_TYPE_SORT_MAP.put("100.", 100); + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillDateSubValidatorOp.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillDateSubValidatorOp.java index b12a472..15c00e8 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillDateSubValidatorOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/operate/MaterialInBillDateSubValidatorOp.java @@ -12,6 +12,8 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.Date; /** @@ -67,9 +69,13 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请 Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间 Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期 - if (auditdate != null && bizdate != null && auditdate.after(bizdate)) { - this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于业务日期!"); - continue; + if (auditdate != null && bizdate != null) { + LocalDate auditLocalDate = auditdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate bizLocalDate = bizdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + if (auditLocalDate.isAfter(bizLocalDate)) { + this.addFatalErrorMessage(extendedDataEntity, "采购申请单" + zcgj_number + "的审批日期不能晚于业务日期!"); + continue; + } } DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息 if (zcgj_entryentityCollection.size() > 0) { @@ -78,8 +84,12 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl if (zcgj_invoice != null) { Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期 String billno = zcgj_invoice.getString("billno"); - if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) { - this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于发票:" + billno + "的开票日期!"); + if (auditdate != null && invoicedate != null) { + LocalDate auditLocalDate = auditdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate bizLocalDate = invoicedate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + if (auditLocalDate.isAfter(bizLocalDate)) { + this.addFatalErrorMessage(extendedDataEntity, "采购申请单" + zcgj_number + "的审批日期不能晚于发票" + billno + "的开票日期!"); + } } } } @@ -95,9 +105,13 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请 Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间 Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期 - if (auditdate != null && bizdate != null && auditdate.after(bizdate)) { - this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于业务日期!"); - continue; + if (auditdate != null && bizdate != null) { + LocalDate auditLocalDate = auditdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate bizLocalDate = bizdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + if (auditLocalDate.isAfter(bizLocalDate)) { + this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于业务日期!"); + continue; + } } DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息 if (zcgj_entryentityCollection.size() > 0) { @@ -106,8 +120,12 @@ public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePl if (zcgj_invoice != null) { Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期 String billno = zcgj_invoice.getString("billno"); - if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) { - this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于发票:" + billno + "的开票日期!"); + if (auditdate != null && invoicedate != null) { + LocalDate auditLocalDate = auditdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate bizLocalDate = invoicedate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + if (auditLocalDate.isAfter(bizLocalDate)) { + this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于发票" + billno + "的开票日期!"); + } } } }