From 2b1929979feb12859a23f54e7216351f473f417a Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Tue, 27 Feb 2024 19:29:01 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E6=B5=81=E7=A8=8B=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1081086489100288]流程管理-流程导入异常 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1081086489100288 --- .../handler/CiImportExportHandler.java | 538 +++++++++--------- 1 file changed, 272 insertions(+), 266 deletions(-) diff --git a/src/main/java/neatlogic/module/cmdb/importexport/handler/CiImportExportHandler.java b/src/main/java/neatlogic/module/cmdb/importexport/handler/CiImportExportHandler.java index d992d289..799b8538 100644 --- a/src/main/java/neatlogic/module/cmdb/importexport/handler/CiImportExportHandler.java +++ b/src/main/java/neatlogic/module/cmdb/importexport/handler/CiImportExportHandler.java @@ -16,26 +16,20 @@ package neatlogic.module.cmdb.importexport.handler; -import neatlogic.framework.cmdb.dto.ci.*; -import neatlogic.framework.cmdb.enums.CmdbImportExportHandlerType; +import neatlogic.framework.cmdb.dto.ci.CiVo; import neatlogic.framework.cmdb.exception.ci.CiNotFoundException; -import neatlogic.framework.file.dao.mapper.FileMapper; import neatlogic.framework.importexport.constvalue.FrameworkImportExportHandlerType; import neatlogic.framework.importexport.core.ImportExportHandlerBase; import neatlogic.framework.importexport.core.ImportExportHandlerType; import neatlogic.framework.importexport.dto.ImportExportBaseInfoVo; import neatlogic.framework.importexport.dto.ImportExportPrimaryChangeVo; import neatlogic.framework.importexport.dto.ImportExportVo; -import neatlogic.module.cmdb.dao.mapper.ci.*; -import neatlogic.module.cmdb.service.attr.AttrService; -import neatlogic.module.cmdb.service.ci.CiService; -import org.apache.commons.collections4.CollectionUtils; +import neatlogic.module.cmdb.dao.mapper.ci.CiMapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; import java.util.zip.ZipOutputStream; @Component @@ -44,26 +38,26 @@ public class CiImportExportHandler extends ImportExportHandlerBase { @Resource private CiMapper ciMapper; - @Resource - private FileMapper fileMapper; - - @Resource - private AttrMapper attrMapper; - - @Resource - private CiViewMapper ciViewMapper; - - @Resource - private RelMapper relMapper; - - @Resource - private CiAuthMapper ciAuthMapper; - - @Resource - private CiService ciService; - - @Resource - private AttrService attrService; +// @Resource +// private FileMapper fileMapper; +// +// @Resource +// private AttrMapper attrMapper; +// +// @Resource +// private CiViewMapper ciViewMapper; +// +// @Resource +// private RelMapper relMapper; +// +// @Resource +// private CiAuthMapper ciAuthMapper; +// +// @Resource +// private CiService ciService; +// +// @Resource +// private AttrService attrService; @Override public ImportExportHandlerType getType() { @@ -83,157 +77,169 @@ public class CiImportExportHandler extends ImportExportHandlerBase { @Override public boolean checkIsExists(ImportExportBaseInfoVo importExportBaseInfoVo) { - return ciMapper.getCiByName(importExportBaseInfoVo.getName()) != null - || ciMapper.getCiById((Long)importExportBaseInfoVo.getPrimaryKey()) != null; + CiVo ciVo = ciMapper.getCiById((Long)importExportBaseInfoVo.getPrimaryKey()); + if (ciVo == null) { + if (StringUtils.isNotBlank(importExportBaseInfoVo.getName())) { + throw new CiNotFoundException(importExportBaseInfoVo.getName() + "[" + importExportBaseInfoVo.getPrimaryKey() + "]"); + } else { + throw new CiNotFoundException((Long) importExportBaseInfoVo.getPrimaryKey()); + } + } + return true; +// return ciMapper.getCiByName(importExportBaseInfoVo.getName()) != null +// || ciMapper.getCiById((Long)importExportBaseInfoVo.getPrimaryKey()) != null; } @Override public Object getPrimaryByName(ImportExportVo importExportVo) { - CiVo ci = ciMapper.getCiByName(importExportVo.getName()); - if (ci == null) { - throw new CiNotFoundException(importExportVo.getName()); - } - return ci.getId(); +// CiVo ci = ciMapper.getCiByName(importExportVo.getName()); +// if (ci == null) { +// throw new CiNotFoundException(importExportVo.getName()); +// } +// return ci.getId(); + return null; } @Override public Object importData(ImportExportVo importExportVo, List primaryChangeList) { - CiVo ciVo = importExportVo.getData().toJavaObject(CiVo.class); - Long originalId = ciVo.getId(); - CiVo oldCi = ciMapper.getCiById(ciVo.getId()); - if (oldCi == null) { - oldCi = ciMapper.getCiByName(ciVo.getName()); - if (oldCi != null) { - ciVo.setId(oldCi.getId()); - } - } - importHandle(ciVo, primaryChangeList); - List relList = ciVo.getRelList(); - for (RelVo relVo : relList) { - if (Objects.equals(relVo.getFromCiId(), originalId)) { - relVo.setFromCiId(ciVo.getId()); - } - if (Objects.equals(relVo.getToCiId(), originalId)) { - relVo.setToCiId(ciVo.getId()); - } - } - List attrList = ciVo.getAttrList(); - for (AttrVo attr : attrList) { - attr.setCiId(ciVo.getId()); - } - ciVo.setAttrList(null); - if (oldCi == null) { - ciService.insertCi(ciVo); - List oldRelList = relMapper.getRelBaseInfoByCiId(ciVo.getId()); - List oldRelIdList = oldRelList.stream().map(RelVo::getId).collect(Collectors.toList()); - for (RelVo relVo : relList) { - if (oldRelIdList.contains(relVo.getId())) { - relMapper.updateRel(relVo); - relMapper.deleteRelativeRelByRelId(relVo.getId()); - } else { - relMapper.insertRel(relVo); - } - if (CollectionUtils.isNotEmpty(relVo.getRelativeRelList())) { - for (RelativeRelVo relativeRelVo : relVo.getRelativeRelList()) { - relativeRelVo.setRelId(relVo.getId()); - relMapper.insertRelativeRel(relativeRelVo); - } - } - } - if (Objects.equals(ciVo.getIsVirtual(), 0)) { - for (AttrVo attr : attrList) { - attrService.insertAttr(attr); - } - } - } else { - ciService.updateCi(ciVo); - List oldRelList = relMapper.getRelBaseInfoByCiId(oldCi.getId()); - List oldRelIdList = oldRelList.stream().map(RelVo::getId).collect(Collectors.toList()); - for (RelVo relVo : relList) { - if (oldRelIdList.contains(relVo.getId())) { - relMapper.updateRel(relVo); - relMapper.deleteRelativeRelByRelId(relVo.getId()); - } else { - relMapper.insertRel(relVo); - } - if (CollectionUtils.isNotEmpty(relVo.getRelativeRelList())) { - for (RelativeRelVo relativeRelVo : relVo.getRelativeRelList()) { - relativeRelVo.setRelId(relVo.getId()); - relMapper.insertRelativeRel(relativeRelVo); - } - } - } - if (Objects.equals(ciVo.getIsVirtual(), 0)) { - List oldAttrList = attrMapper.getDeclaredAttrListByCiId(oldCi.getId()); - List oldAttrIdList = oldAttrList.stream().map(AttrVo::getId).collect(Collectors.toList()); - for (AttrVo attr : attrList) { - if (oldAttrIdList.contains(attr.getId())) { - attrService.updateAttr(attr); - } else { - attrService.insertAttr(attr); - } - } - } - relMapper.deleteRelGroupByCiId(ciVo.getId()); - ciViewMapper.deleteCiViewByCiId(ciVo.getId()); - ciAuthMapper.deleteCiAuthByCiId(ciVo.getId()); - if (CollectionUtils.isNotEmpty(oldCi.getUniqueAttrIdList())) { - ciMapper.deleteCiUniqueByCiId(ciVo.getId()); - } - } - List relGroupList = ciVo.getRelGroupList(); - for (RelGroupVo relGroup : relGroupList) { - relGroup.setCiId(ciVo.getId()); - relMapper.insertRelGroup(relGroup); - } - List viewList = ciVo.getViewList(); - for (CiViewVo view : viewList) { - view.setCiId(ciVo.getId()); - ciViewMapper.insertCiView(view); - } - List authList = ciVo.getAuthList(); - for (CiAuthVo auth : authList) { - auth.setCiId(ciVo.getId()); - ciAuthMapper.insertCiAuth(auth); - } - List uniqueAttrIdList = ciVo.getUniqueAttrIdList(); - for (Long attrId : uniqueAttrIdList) { - ciMapper.insertCiUnique(ciVo.getId(), attrId); - } - return ciVo.getId(); +// CiVo ciVo = importExportVo.getData().toJavaObject(CiVo.class); +// Long originalId = ciVo.getId(); +// CiVo oldCi = ciMapper.getCiById(ciVo.getId()); +// if (oldCi == null) { +// oldCi = ciMapper.getCiByName(ciVo.getName()); +// if (oldCi != null) { +// ciVo.setId(oldCi.getId()); +// } +// } +// importHandle(ciVo, primaryChangeList); +// List relList = ciVo.getRelList(); +// for (RelVo relVo : relList) { +// if (Objects.equals(relVo.getFromCiId(), originalId)) { +// relVo.setFromCiId(ciVo.getId()); +// } +// if (Objects.equals(relVo.getToCiId(), originalId)) { +// relVo.setToCiId(ciVo.getId()); +// } +// } +// List attrList = ciVo.getAttrList(); +// for (AttrVo attr : attrList) { +// attr.setCiId(ciVo.getId()); +// } +// ciVo.setAttrList(null); +// if (oldCi == null) { +// ciService.insertCi(ciVo); +// List oldRelList = relMapper.getRelBaseInfoByCiId(ciVo.getId()); +// List oldRelIdList = oldRelList.stream().map(RelVo::getId).collect(Collectors.toList()); +// for (RelVo relVo : relList) { +// if (oldRelIdList.contains(relVo.getId())) { +// relMapper.updateRel(relVo); +// relMapper.deleteRelativeRelByRelId(relVo.getId()); +// } else { +// relMapper.insertRel(relVo); +// } +// if (CollectionUtils.isNotEmpty(relVo.getRelativeRelList())) { +// for (RelativeRelVo relativeRelVo : relVo.getRelativeRelList()) { +// relativeRelVo.setRelId(relVo.getId()); +// relMapper.insertRelativeRel(relativeRelVo); +// } +// } +// } +// if (Objects.equals(ciVo.getIsVirtual(), 0)) { +// for (AttrVo attr : attrList) { +// attrService.insertAttr(attr); +// } +// } +// } else { +// ciService.updateCi(ciVo); +// List oldRelList = relMapper.getRelBaseInfoByCiId(oldCi.getId()); +// List oldRelIdList = oldRelList.stream().map(RelVo::getId).collect(Collectors.toList()); +// for (RelVo relVo : relList) { +// if (oldRelIdList.contains(relVo.getId())) { +// relMapper.updateRel(relVo); +// relMapper.deleteRelativeRelByRelId(relVo.getId()); +// } else { +// relMapper.insertRel(relVo); +// } +// if (CollectionUtils.isNotEmpty(relVo.getRelativeRelList())) { +// for (RelativeRelVo relativeRelVo : relVo.getRelativeRelList()) { +// relativeRelVo.setRelId(relVo.getId()); +// relMapper.insertRelativeRel(relativeRelVo); +// } +// } +// } +// if (Objects.equals(ciVo.getIsVirtual(), 0)) { +// List oldAttrList = attrMapper.getDeclaredAttrListByCiId(oldCi.getId()); +// List oldAttrIdList = oldAttrList.stream().map(AttrVo::getId).collect(Collectors.toList()); +// for (AttrVo attr : attrList) { +// if (oldAttrIdList.contains(attr.getId())) { +// attrService.updateAttr(attr); +// } else { +// attrService.insertAttr(attr); +// } +// } +// } +// relMapper.deleteRelGroupByCiId(ciVo.getId()); +// ciViewMapper.deleteCiViewByCiId(ciVo.getId()); +// ciAuthMapper.deleteCiAuthByCiId(ciVo.getId()); +// if (CollectionUtils.isNotEmpty(oldCi.getUniqueAttrIdList())) { +// ciMapper.deleteCiUniqueByCiId(ciVo.getId()); +// } +// } +// List relGroupList = ciVo.getRelGroupList(); +// for (RelGroupVo relGroup : relGroupList) { +// relGroup.setCiId(ciVo.getId()); +// relMapper.insertRelGroup(relGroup); +// } +// List viewList = ciVo.getViewList(); +// for (CiViewVo view : viewList) { +// view.setCiId(ciVo.getId()); +// ciViewMapper.insertCiView(view); +// } +// List authList = ciVo.getAuthList(); +// for (CiAuthVo auth : authList) { +// auth.setCiId(ciVo.getId()); +// ciAuthMapper.insertCiAuth(auth); +// } +// List uniqueAttrIdList = ciVo.getUniqueAttrIdList(); +// for (Long attrId : uniqueAttrIdList) { +// ciMapper.insertCiUnique(ciVo.getId(), attrId); +// } +// return ciVo.getId(); + return null; } @Override protected ImportExportVo myExportData(Object primaryKey, List dependencyList, ZipOutputStream zipOutputStream) { - Long id = (Long) primaryKey; - CiVo ciVo = ciMapper.getCiById(id); - if (ciVo == null) { - throw new CiNotFoundException(id); - } - if (Objects.equals(ciVo.getIsVirtual(), 1) && ciVo.getFileId() != null) { - String viewXml = ciMapper.getCiViewXmlById(ciVo.getId()); - ciVo.setViewXml(viewXml); - } - List attrList = attrMapper.getDeclaredAttrListByCiId(id); - List relList = relMapper.getRelBaseInfoByCiId(id); - for (RelVo rel : relList) { - List relativeRelList = relMapper.getRelativeRelByRelId(rel.getId()); - rel.setRelativeRelList(relativeRelList); - } - List relGroupList = relMapper.getRelGroupByCiId(id); - List viewList = ciViewMapper.getCiViewBaseInfoByCiId(id); - List authList = ciAuthMapper.getCiAuthByCiId(id); - List uniqueAttrIdList = ciMapper.getCiUniqueByCiId(id); - ciVo.setAttrList(attrList); - ciVo.setRelList(relList); - ciVo.setViewList(viewList); - ciVo.setAuthList(authList); - ciVo.setUniqueAttrIdList(uniqueAttrIdList); - ciVo.setRelGroupList(relGroupList); - exportHandle(ciVo, dependencyList, zipOutputStream); - ImportExportVo importExportVo = new ImportExportVo(this.getType().getValue(), primaryKey, ciVo.getName()); - importExportVo.setDataWithObject(ciVo); - return importExportVo; +// Long id = (Long) primaryKey; +// CiVo ciVo = ciMapper.getCiById(id); +// if (ciVo == null) { +// throw new CiNotFoundException(id); +// } +// if (Objects.equals(ciVo.getIsVirtual(), 1) && ciVo.getFileId() != null) { +// String viewXml = ciMapper.getCiViewXmlById(ciVo.getId()); +// ciVo.setViewXml(viewXml); +// } +// List attrList = attrMapper.getDeclaredAttrListByCiId(id); +// List relList = relMapper.getRelBaseInfoByCiId(id); +// for (RelVo rel : relList) { +// List relativeRelList = relMapper.getRelativeRelByRelId(rel.getId()); +// rel.setRelativeRelList(relativeRelList); +// } +// List relGroupList = relMapper.getRelGroupByCiId(id); +// List viewList = ciViewMapper.getCiViewBaseInfoByCiId(id); +// List authList = ciAuthMapper.getCiAuthByCiId(id); +// List uniqueAttrIdList = ciMapper.getCiUniqueByCiId(id); +// ciVo.setAttrList(attrList); +// ciVo.setRelList(relList); +// ciVo.setViewList(viewList); +// ciVo.setAuthList(authList); +// ciVo.setUniqueAttrIdList(uniqueAttrIdList); +// ciVo.setRelGroupList(relGroupList); +// exportHandle(ciVo, dependencyList, zipOutputStream); +// ImportExportVo importExportVo = new ImportExportVo(this.getType().getValue(), primaryKey, ciVo.getName()); +// importExportVo.setDataWithObject(ciVo); +// return importExportVo; + return null; } /** @@ -241,9 +247,9 @@ public class CiImportExportHandler extends ImportExportHandlerBase { * @param ciVo * @param primaryChangeList */ - private void importHandle(CiVo ciVo, List primaryChangeList) { - handleDependency(IMPORT, ciVo, null, null, primaryChangeList); - } +// private void importHandle(CiVo ciVo, List primaryChangeList) { +// handleDependency(IMPORT, ciVo, null, null, primaryChangeList); +// } /** * 导出处理,先导出依赖组件 @@ -251,100 +257,100 @@ public class CiImportExportHandler extends ImportExportHandlerBase { * @param dependencyList * @param zipOutputStream */ - private void exportHandle(CiVo ciVo, List dependencyList, ZipOutputStream zipOutputStream) { - handleDependency(EXPORT, ciVo, dependencyList, zipOutputStream, null); - } +// private void exportHandle(CiVo ciVo, List dependencyList, ZipOutputStream zipOutputStream) { +// handleDependency(EXPORT, ciVo, dependencyList, zipOutputStream, null); +// } - private void handleDependency(String action, CiVo ciVo, List dependencyList, ZipOutputStream zipOutputStream, List primaryChangeList) { - if (ciVo.getParentCiId() != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, ciVo.getParentCiId(), primaryChangeList); - if (newPrimaryKey != null) { - ciVo.setParentCiId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(FrameworkImportExportHandlerType.CMDB_CI, ciVo.getParentCiId(), dependencyList, zipOutputStream); - } - } - if (ciVo.getTypeId() != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_TYPE, ciVo.getTypeId(), primaryChangeList); - if (newPrimaryKey != null) { - ciVo.setTypeId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(CmdbImportExportHandlerType.CI_TYPE, ciVo.getTypeId(), dependencyList, zipOutputStream); - } - } - if (Objects.equals(ciVo.getIsVirtual(), 1) && ciVo.getFileId() != null && fileMapper.getFileById(ciVo.getFileId()) != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.FILE, ciVo.getFileId(), primaryChangeList); - if (newPrimaryKey != null) { - ciVo.setFileId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(FrameworkImportExportHandlerType.FILE, ciVo.getFileId(), dependencyList, zipOutputStream); - } - } - List attrList = ciVo.getAttrList(); - if (CollectionUtils.isNotEmpty(attrList)) { - for (AttrVo attr : attrList) { - if (attr.getTargetCiId() != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, attr.getTargetCiId(), primaryChangeList); - if (newPrimaryKey != null) { - attr.setTargetCiId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(FrameworkImportExportHandlerType.CMDB_CI, attr.getTargetCiId(), dependencyList, zipOutputStream); - } - } - if (attr.getValidatorId() != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_VALIDATOR, attr.getValidatorId(), primaryChangeList); - if (newPrimaryKey != null) { - attr.setValidatorId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(CmdbImportExportHandlerType.CI_VALIDATOR, attr.getValidatorId(), dependencyList, zipOutputStream); - } - } - } - } - List relList = ciVo.getRelList(); - if (CollectionUtils.isNotEmpty(relList)) { - for (RelVo rel : relList) { - if (rel.getTypeId() != null) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_REL_TYPE, rel.getTypeId(), primaryChangeList); - if (newPrimaryKey != null) { - rel.setTypeId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(CmdbImportExportHandlerType.CI_REL_TYPE, rel.getTypeId(), dependencyList, zipOutputStream); - } - } - if (rel.getFromCiId() != null && !Objects.equals(rel.getFromCiId(), ciVo.getId())) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, rel.getFromCiId(), primaryChangeList); - if (newPrimaryKey != null) { - rel.setFromCiId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(FrameworkImportExportHandlerType.CMDB_CI, rel.getFromCiId(), dependencyList, zipOutputStream); - } - } - if (rel.getToCiId() != null && !Objects.equals(rel.getToCiId(), ciVo.getId())) { - if (action == IMPORT) { - Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, rel.getToCiId(), primaryChangeList); - if (newPrimaryKey != null) { - rel.setToCiId((Long) newPrimaryKey); - } - } else if (action == EXPORT) { - doExportData(FrameworkImportExportHandlerType.CMDB_CI, rel.getToCiId(), dependencyList, zipOutputStream); - } - } - } - } - } +// private void handleDependency(String action, CiVo ciVo, List dependencyList, ZipOutputStream zipOutputStream, List primaryChangeList) { +// if (ciVo.getParentCiId() != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, ciVo.getParentCiId(), primaryChangeList); +// if (newPrimaryKey != null) { +// ciVo.setParentCiId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(FrameworkImportExportHandlerType.CMDB_CI, ciVo.getParentCiId(), dependencyList, zipOutputStream); +// } +// } +// if (ciVo.getTypeId() != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_TYPE, ciVo.getTypeId(), primaryChangeList); +// if (newPrimaryKey != null) { +// ciVo.setTypeId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(CmdbImportExportHandlerType.CI_TYPE, ciVo.getTypeId(), dependencyList, zipOutputStream); +// } +// } +// if (Objects.equals(ciVo.getIsVirtual(), 1) && ciVo.getFileId() != null && fileMapper.getFileById(ciVo.getFileId()) != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.FILE, ciVo.getFileId(), primaryChangeList); +// if (newPrimaryKey != null) { +// ciVo.setFileId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(FrameworkImportExportHandlerType.FILE, ciVo.getFileId(), dependencyList, zipOutputStream); +// } +// } +// List attrList = ciVo.getAttrList(); +// if (CollectionUtils.isNotEmpty(attrList)) { +// for (AttrVo attr : attrList) { +// if (attr.getTargetCiId() != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, attr.getTargetCiId(), primaryChangeList); +// if (newPrimaryKey != null) { +// attr.setTargetCiId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(FrameworkImportExportHandlerType.CMDB_CI, attr.getTargetCiId(), dependencyList, zipOutputStream); +// } +// } +// if (attr.getValidatorId() != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_VALIDATOR, attr.getValidatorId(), primaryChangeList); +// if (newPrimaryKey != null) { +// attr.setValidatorId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(CmdbImportExportHandlerType.CI_VALIDATOR, attr.getValidatorId(), dependencyList, zipOutputStream); +// } +// } +// } +// } +// List relList = ciVo.getRelList(); +// if (CollectionUtils.isNotEmpty(relList)) { +// for (RelVo rel : relList) { +// if (rel.getTypeId() != null) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(CmdbImportExportHandlerType.CI_REL_TYPE, rel.getTypeId(), primaryChangeList); +// if (newPrimaryKey != null) { +// rel.setTypeId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(CmdbImportExportHandlerType.CI_REL_TYPE, rel.getTypeId(), dependencyList, zipOutputStream); +// } +// } +// if (rel.getFromCiId() != null && !Objects.equals(rel.getFromCiId(), ciVo.getId())) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, rel.getFromCiId(), primaryChangeList); +// if (newPrimaryKey != null) { +// rel.setFromCiId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(FrameworkImportExportHandlerType.CMDB_CI, rel.getFromCiId(), dependencyList, zipOutputStream); +// } +// } +// if (rel.getToCiId() != null && !Objects.equals(rel.getToCiId(), ciVo.getId())) { +// if (action == IMPORT) { +// Object newPrimaryKey = getNewPrimaryKey(FrameworkImportExportHandlerType.CMDB_CI, rel.getToCiId(), primaryChangeList); +// if (newPrimaryKey != null) { +// rel.setToCiId((Long) newPrimaryKey); +// } +// } else if (action == EXPORT) { +// doExportData(FrameworkImportExportHandlerType.CMDB_CI, rel.getToCiId(), dependencyList, zipOutputStream); +// } +// } +// } +// } +// } } -- Gitee