From 6212303430c698c54d6874ab8c942ed0846e314f Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 21 Nov 2025 16:46:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=A0=B9=E6=A8=A1=E5=9E=8B=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=8F=AF=E6=89=A7=E8=A1=8C=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1559494255935488]资产清单根模型设置为操作系统时,创建作业时报错缺少可执行节点 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1559494255935488 --- .../config/SaveAssertListDisplayApi.java | 7 --- .../resourcecenter/ResourceEntityMapper.java | 6 -- .../resourcecenter/ResourceEntityMapper.xml | 13 ----- .../resourcecenter/ResourceEntityService.java | 20 +++++++ .../ResourceEntityServiceImpl.java | 56 +++++++++++++++++++ .../ResourceCenterResourceServiceImpl.java | 10 +++- 6 files changed, 85 insertions(+), 27 deletions(-) create mode 100644 src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityService.java create mode 100644 src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityServiceImpl.java diff --git a/src/main/java/neatlogic/module/cmdb/api/resourcecenter/config/SaveAssertListDisplayApi.java b/src/main/java/neatlogic/module/cmdb/api/resourcecenter/config/SaveAssertListDisplayApi.java index f1014c33..618fd946 100644 --- a/src/main/java/neatlogic/module/cmdb/api/resourcecenter/config/SaveAssertListDisplayApi.java +++ b/src/main/java/neatlogic/module/cmdb/api/resourcecenter/config/SaveAssertListDisplayApi.java @@ -78,13 +78,6 @@ public class SaveAssertListDisplayApi extends PrivateApiComponentBase { if (ciVo == null) { throw new CiNotFoundException(rootCiName); } - List ciIdList = resourceEntityMapper.getAllResourceTypeCiIdList(); - if (!ciIdList.contains(ciVo.getId())) { - if (CollectionUtils.isNotEmpty(ciIdList)) { - resourceEntityMapper.deleteResourceTypeCi(); - } - resourceEntityMapper.insertResourceTypeCi(ciVo.getId()); - } resourceEntityMapper.insertAssetListDisplay(assetListDisplayVo); return null; } diff --git a/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.java b/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.java index 218b8a09..200c52cb 100644 --- a/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.java +++ b/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.java @@ -31,8 +31,6 @@ public interface ResourceEntityMapper extends IResourceEntityCrossoverMapper { String getResourceEntityConfigByName(String name); - List getAllResourceTypeCiIdList(ResourceSearchVo searchVo); - int getResourceEntityViewDataCount(String name); List> getResourceEntityViewDataList(@Param("name") String name, @Param("startNum") int startNum, @Param("pageSize") int pageSize); @@ -43,8 +41,6 @@ public interface ResourceEntityMapper extends IResourceEntityCrossoverMapper { void insertResourceEntity(ResourceEntityVo resourceEntityVo); - void insertResourceTypeCi(Long ciId); - int insertApplicationListDisplay(ApplicationListDisplayVo applicationListDisplayVo); int insertAssetListDisplay(AssetListDisplayVo assetListDisplayVo); @@ -56,6 +52,4 @@ public interface ResourceEntityMapper extends IResourceEntityCrossoverMapper { void updateResourceEntityLabelAndDescription(ResourceEntityVo resourceEntityVo); void deleteResourceEntityByName(String name); - - void deleteResourceTypeCi(); } diff --git a/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.xml b/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.xml index f7e1a11c..2dda5867 100644 --- a/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.xml +++ b/src/main/java/neatlogic/module/cmdb/dao/mapper/resourcecenter/ResourceEntityMapper.xml @@ -47,10 +47,6 @@ along with this program. If not, see .--> WHERE `name` = #{value} - - @@ -109,11 +105,6 @@ along with this program. If not, see .--> `init_time` = NOW(3) - - INSERT INTO `cmdb_resourcecenter_type_ci` (`ci_id`) - VALUES (#{value}) - - INSERT INTO `cmdb_resourcecenter_applicationlist_display` ( `id`, @@ -189,8 +180,4 @@ along with this program. If not, see .--> FROM cmdb_resourcecenter_entity WHERE name = #{value} - - - DELETE FROM `cmdb_resourcecenter_type_ci` - diff --git a/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityService.java b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityService.java new file mode 100644 index 00000000..696b81ad --- /dev/null +++ b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityService.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2025 TechSure Co., Ltd. All Rights Reserved. + * This file is part of the NeatLogic software. + * Licensed under the NeatLogic Sustainable Use License (NSUL), Version 4.x – 2025. + * You may use this file only in compliance with the License. + * See the LICENSE file distributed with this work for the full license text. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + */ + +package neatlogic.module.cmdb.service.resourcecenter; + +import neatlogic.framework.cmdb.dto.ci.CiVo; + +public interface ResourceEntityService { + + CiVo getAssetListRootCi(); + + CiVo getViewRootCi(String viewName); +} diff --git a/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityServiceImpl.java b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityServiceImpl.java new file mode 100644 index 00000000..6e625e8b --- /dev/null +++ b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/ResourceEntityServiceImpl.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2025 TechSure Co., Ltd. All Rights Reserved. + * This file is part of the NeatLogic software. + * Licensed under the NeatLogic Sustainable Use License (NSUL), Version 4.x – 2025. + * You may use this file only in compliance with the License. + * See the LICENSE file distributed with this work for the full license text. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + */ + +package neatlogic.module.cmdb.service.resourcecenter; + +import neatlogic.framework.cmdb.crossover.ICiCrossoverMapper; +import neatlogic.framework.cmdb.crossover.IResourceEntityCrossoverService; +import neatlogic.framework.cmdb.dto.ci.CiVo; +import neatlogic.framework.cmdb.dto.resourcecenter.AssetListDisplayVo; +import neatlogic.framework.cmdb.dto.resourcecenter.config.ResourceEntityConfigVo; +import neatlogic.framework.cmdb.dto.resourcecenter.config.ResourceEntityVo; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceEntityMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class ResourceEntityServiceImpl implements ResourceEntityService, IResourceEntityCrossoverService { + + @Resource + private ResourceEntityMapper resourceEntityMapper; + + @Override + public CiVo getAssetListRootCi() { + AssetListDisplayVo assetListDisplay = resourceEntityMapper.getAssetListDisplay(); + if (assetListDisplay != null && StringUtils.isNotBlank(assetListDisplay.getRootCiName())) { + ICiCrossoverMapper ciCrossoverMapper = CrossoverServiceFactory.getApi(ICiCrossoverMapper.class); + return ciCrossoverMapper.getCiByName(assetListDisplay.getRootCiName()); + } + return null; + } + + @Override + public CiVo getViewRootCi(String viewName) { + ResourceEntityVo resourceEntityVo = resourceEntityMapper.getResourceEntityByName(viewName); + if (resourceEntityVo != null) { + ResourceEntityConfigVo config = resourceEntityVo.getConfig(); + if (config != null) { + if (StringUtils.isNotBlank(config.getMainCi())) { + ICiCrossoverMapper ciCrossoverMapper = CrossoverServiceFactory.getApi(ICiCrossoverMapper.class); + return ciCrossoverMapper.getCiByName(config.getMainCi()); + } + } + } + return null; + } +} diff --git a/src/main/java/neatlogic/module/cmdb/service/resourcecenter/resource/ResourceCenterResourceServiceImpl.java b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/resource/ResourceCenterResourceServiceImpl.java index bf692031..7fcb73d1 100644 --- a/src/main/java/neatlogic/module/cmdb/service/resourcecenter/resource/ResourceCenterResourceServiceImpl.java +++ b/src/main/java/neatlogic/module/cmdb/service/resourcecenter/resource/ResourceCenterResourceServiceImpl.java @@ -37,6 +37,7 @@ import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceAccountMapper; import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceEntityMapper; import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceMapper; import neatlogic.module.cmdb.dao.mapper.resourcecenter.ResourceTagMapper; +import neatlogic.module.cmdb.service.resourcecenter.ResourceEntityService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -79,10 +80,17 @@ public class ResourceCenterResourceServiceImpl implements IResourceCenterResourc @Resource private ResourceBuildSqlService resourceBuildSqlService; + @Resource + private ResourceEntityService resourceEntityService; + @Override public ResourceSearchVo assembleResourceSearchVo(JSONObject jsonObj) { if (!jsonObj.containsKey("typeId") && !jsonObj.containsKey("typeIdList")) { - List ciIdList = resourceEntityMapper.getAllResourceTypeCiIdList(); + List ciIdList = new ArrayList<>(); + CiVo rootCiVo = resourceEntityService.getViewRootCi("scence_ipobject_detail"); + if (rootCiVo != null) { + ciIdList.add(rootCiVo.getId()); + } jsonObj.put("typeIdList", ciIdList); } return assembleResourceSearchVo(jsonObj, true); -- Gitee