From c646cf99bb62e2e0df574343b223a0d965463eee Mon Sep 17 00:00:00 2001 From: zhangweiqing Date: Fri, 30 Aug 2024 14:21:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=86=E7=BA=A7=E7=A0=81?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=A0=91=E5=88=A0=E9=99=A4=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=90=8E=E7=88=B6=E8=8A=82=E7=82=B9=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=9C=AA=E6=9B=B4=E6=96=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/dtm/BuiltInEngineDtmAdaptor.java | 32 +++++++++++++++---- .../engine/core/dtm/DtmComponentManager.java | 4 ++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/BuiltInEngineDtmAdaptor.java b/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/BuiltInEngineDtmAdaptor.java index 5775026..d8b92d2 100644 --- a/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/BuiltInEngineDtmAdaptor.java +++ b/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/BuiltInEngineDtmAdaptor.java @@ -24,15 +24,21 @@ import com.inspur.edp.cef.designtime.api.IGspCommonField; import com.inspur.edp.cef.entity.changeset.ChangeType; import com.inspur.edp.cef.entity.changeset.IChangeDetail; import com.inspur.edp.cef.spi.determination.IDetermination; -import com.inspur.edp.common.component.actionextension.*; +import com.inspur.edp.common.component.actionextension.AttachmentBeforSaveDetermination; +import com.inspur.edp.common.component.actionextension.CancelAttachmentTempDeter; +import com.inspur.edp.common.component.actionextension.DelPathTreeCheck; +import com.inspur.edp.common.component.actionextension.DeleteDetermination; +import com.inspur.edp.common.component.actionextension.ParentTreeDeleteDeter; +import com.inspur.edp.common.component.actionextension.TreeBeforSaveDetermination; import com.inspur.edp.common.component.timestamp.CreatedByBeforeSaveDetermination; import com.inspur.edp.common.component.timestamp.LastModifiedByBeforeSaveDetermination; import com.inspur.edp.common.component.timestamp.TimeStampDetermination; -import com.inspur.edp.common.component.workflow.WorkFolwBeforeSaveDetermination; +import lombok.extern.slf4j.Slf4j; /** * 内置udt构件适配 */ +@Slf4j public class BuiltInEngineDtmAdaptor implements IDetermination { private IGspCommonField gspCommonField; private GspBizEntityObject gspBizEntityObject; @@ -79,11 +85,23 @@ public class BuiltInEngineDtmAdaptor implements IDetermination { new TimeStampDetermination((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); } if (gspCommonField.getUdtID().equals("dbfbe55d-ba65-4a7f-a9d4-4f664ec6ec68") && gspBizEntityObject.getBelongModel().getEnableTreeDtm()) {//分级码 - if (change.getChangeType() == ChangeType.Deleted) { - new DeleteDetermination((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); - new DelPathTreeCheck((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); - } else if (change.getChangeType() == ChangeType.Added) { - new TreeBeforSaveDetermination((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); + //分级码树处理逻辑: + //新增行:通过公共构件新增行,如:分级码分级方式新增同级、分级码分级方式新增子级等。在构件中除为新增行赋默认分级码外,还更新了新增行的父节点中分级码的是否明细属性。 + //新增行-保存前:根据分级码缓存重新生成分级码,并更新分级码缓存。 + //修改行:使用BEF的通用接口直接修改数据。分级码相关逻辑完全不参与 + //删除行:使用BEF的通用接口直接删除数据。 + //删除行-修改后:删除行时,需要判断删除的节点是否有同级节点,如果没有则更新父节点的是否明细值为否。不能在保存前处理该逻辑,否则删除的节点如果是刚刚新增的还没有保存,不触发保存前事件,会造成父节点的是否明细还是否。 + if (triggerType == BETriggerTimePointType.AfterModify) { + if (change.getChangeType() == ChangeType.Deleted) { + new DeleteDetermination((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); + new DelPathTreeCheck((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); + } + } else if (triggerType == BETriggerTimePointType.BeforeCheck) { + if (change.getChangeType() == ChangeType.Added) { + new TreeBeforSaveDetermination((IDeterminationContext) context, change, gspCommonField.getLabelID()).execute(); + } + } else { + log.warn("Should not execute path tree builtin engine dtm when trigger type is: {}", triggerType); } } if (gspCommonField.getUdtID().equals("12be876c-368c-4262-88ab-4112688540b0")) {//父节点 diff --git a/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/DtmComponentManager.java b/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/DtmComponentManager.java index 4203b68..4780acb 100644 --- a/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/DtmComponentManager.java +++ b/business-entity-engine-core/src/main/java/com/inspur/edp/bef/engine/core/dtm/DtmComponentManager.java @@ -58,7 +58,9 @@ public class DtmComponentManager { } public static List getAfterModifyComponents() { - if (afterModifyList.size() == 0) { + if(afterModifyList.size() == 0){ + afterModifyList = new ArrayList<>(); + afterModifyList.add("dbfbe55d-ba65-4a7f-a9d4-4f664ec6ec68");//分级码 } return afterModifyList; } -- Gitee