From 1305b2f13e256681c62203fa2b8b8870d4e4be28 Mon Sep 17 00:00:00 2001 From: huangdehua <2329023417@qq.com> Date: Tue, 11 Aug 2026 18:07:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=97=B6=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=8D=95=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../association/plugin/member/UnitNameChangeFormInitPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java index 2d9dd7c..e9781c8 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java @@ -6,6 +6,7 @@ import apelet.common.generator.utils.OrmGenDataSourceUtil; import apelet.common.online.abstractplugin.ExecutePluginParent; import apelet.common.online.model.constant.AttributeEnum; import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.List; @@ -98,6 +99,7 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { // 获取源单据ID String sourceBillId = getSourceBillId(objectValue); String sourceBillNumber = getSourceBillNumber(objectValue); + this.setWidgetAttribute("history",AttributeEnum.VALUE_CHANGE, "0"); // 如果没有源单据ID,说明不是变更操作,正常返回 if (sourceBillId == null || sourceBillId.isEmpty()) { @@ -147,6 +149,10 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { if (sourceBillId == null || sourceBillId.trim().isEmpty()) { sourceBillId = objectValue.getString(PARAM_BILL_ID_ALT); } + Object idObj = objectValue.get("id"); + if (idObj != null && !Integer.valueOf(0).equals(idObj)) { + return false; + } return sourceBillId != null && !sourceBillId.trim().isEmpty(); } @@ -166,6 +172,7 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { } newBill.put(getDbFieldKey(key), entry.getValue()); } + newBill.put("history", "0"); ObjectCollection detailEntry = copyEntryForManualSave(objectValue.getObjectCollection(CHILD_WIDGET_KEY)); if (detailEntry != null && !detailEntry.isEmpty()) { From ee584216ec86db9af6b7069a660fddcf1c022be6 Mon Sep 17 00:00:00 2001 From: huangdehua <2329023417@qq.com> Date: Thu, 13 Aug 2026 13:52:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=97=B6=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=8D=95=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/MembershipApplyListFilterPlugin.java | 2 +- .../member/UnitNameChangeFormInitPlugin.java | 76 ++++++++++++++++++---- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java index a1530a6..b34db84 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/MembershipApplyListFilterPlugin.java @@ -26,7 +26,7 @@ public class MembershipApplyListFilterPlugin extends ListPlugin { /** * 非历史记录 */ - private static final String IS_HISTORY_NO = "0"; + private static final String IS_HISTORY_NO = "1"; @Override protected Filter getFilter() { diff --git a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java index e9781c8..e0b1fbd 100644 --- a/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java +++ b/common/common-association/src/main/java/apelet/association/plugin/member/UnitNameChangeFormInitPlugin.java @@ -6,7 +6,6 @@ import apelet.common.generator.utils.OrmGenDataSourceUtil; import apelet.common.online.abstractplugin.ExecutePluginParent; import apelet.common.online.model.constant.AttributeEnum; import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.List; @@ -162,6 +161,8 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { throw new RuntimeException("获取数据库连接失败"); } + int version = markOldBillsHistory(ormUtil, objectValue); + ObjectValue newBill = new ObjectValue("membership_apply"); Map values = objectValue.getValues(); for (Object item : values.entrySet()) { @@ -173,6 +174,7 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { newBill.put(getDbFieldKey(key), entry.getValue()); } newBill.put("history", "0"); + newBill.put("version_number", version); ObjectCollection detailEntry = copyEntryForManualSave(objectValue.getObjectCollection(CHILD_WIDGET_KEY)); if (detailEntry != null && !detailEntry.isEmpty()) { @@ -182,6 +184,64 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { ormUtil.addNew("membership_apply", newBill); } + private int markOldBillsHistory(OrmGenDataSourceUtil ormUtil, ObjectValue objectValue) throws Exception { + String sourceBillId = getSourceBillId(objectValue); + if (sourceBillId == null || sourceBillId.trim().isEmpty()) { + sourceBillId = objectValue.getString(PARAM_BILL_ID); + } + if (sourceBillId == null || sourceBillId.trim().isEmpty()) { + sourceBillId = objectValue.getString(PARAM_BILL_ID_ALT); + } + if (sourceBillId == null || sourceBillId.trim().isEmpty()) { + return 1; + } + + apelet.common.orm.impl.Filter sourceFilter = new apelet.common.orm.impl.Filter(); + sourceFilter.add(new apelet.common.orm.impl.FilterItem("id", "=", sourceBillId)); + ObjectCollection sourceCollection = ormUtil.query("membership_apply", sourceFilter, null); + if (sourceCollection == null || sourceCollection.isEmpty()) { + return 1; + } + + ObjectValue sourceBill = sourceCollection.getObject(0); + if (sourceBill == null) { + return 1; + } + + String number = sourceBill.getString("number"); + if (number == null || number.trim().isEmpty()) { + return 1; + } + + apelet.common.orm.impl.Filter sameNumberFilter = new apelet.common.orm.impl.Filter(); + sameNumberFilter.add(new apelet.common.orm.impl.FilterItem("number", "=", number)); + ObjectCollection sameBills = ormUtil.query("membership_apply", sameNumberFilter, null); + if (sameBills == null || sameBills.isEmpty()) { + sourceBill.put("history", "1"); + sourceBill.put("version_number", 1); + ormUtil.update("membership_apply", sourceBill, null); + return 2; + } + + List bills = new java.util.ArrayList<>(); + for (int i = 0; i < sameBills.size(); i++) { + ObjectValue bill = sameBills.getObject(i); + if (bill != null) { + bills.add(bill); + } + } + + bills.sort(java.util.Comparator.comparingInt(this::getVersionNumberSafe)); + int version = 1; + for (ObjectValue bill : bills) { + bill.put("history", "1"); + bill.put("version_number", version); + ormUtil.update("membership_apply", bill, null); + version++; + } + return version; + } + private boolean shouldSkipManualSaveField(String key) { return "id".equals(key) || "eventparams".equals(key) @@ -398,21 +458,13 @@ public class UnitNameChangeFormInitPlugin extends ExecutePluginParent { int version = 1; if (sameBills != null && !sameBills.isEmpty()) { - List bills = new java.util.ArrayList<>(); for (int i = 0; i < sameBills.size(); i++) { ObjectValue bill = sameBills.getObject(i); - if (bill != null) { - bills.add(bill); + int billVersion = getVersionNumberSafe(bill); + if (billVersion >= version) { + version = billVersion + 1; } } - - bills.sort(java.util.Comparator.comparingInt(this::getVersionNumberSafe)); - for (ObjectValue bill : bills) { - bill.put("is_history", 1); - bill.put("version_number", version); - ormUtil.update("membership_apply", bill, null); - version++; - } } objectValue.put("is_history", 0);