From 89efe085c982951ff6cf34ff0a3f121c26fb9663 Mon Sep 17 00:00:00 2001 From: bayuzhen Date: Wed, 6 Nov 2024 14:46:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E6=94=B9=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E6=9C=AA=E5=B1=95=E7=A4=BA=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/instance/impl/InstanceServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/instance/impl/InstanceServiceImpl.java b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/instance/impl/InstanceServiceImpl.java index 2f1d9dc..1a9ff82 100644 --- a/bocloud.ams.service/src/main/java/com/bocloud/ams/service/instance/impl/InstanceServiceImpl.java +++ b/bocloud.ams.service/src/main/java/com/bocloud/ams/service/instance/impl/InstanceServiceImpl.java @@ -984,6 +984,17 @@ public class InstanceServiceImpl implements InstanceService { } instanceHistoryHelper.history(instance, InstanceEnum.catalog.INSTANCE.name(), InstanceEnum.category.MODIFY.name(), userId); + + // 修改资源实例重新创建模型实例关联关系 + List relations = moduleRelationRepository.queryByModuleId(instance.getModuleId()); + for (ModuleRelation relation : relations) { + String relationTable = + CmdbUtils.CMDB_INSTANCE_RELATION + relation.getRelationCategoryCode().toLowerCase(); + instanceRelationRepository.removeByInstanceId(instance.getId(), instance.getModuleId(), relationTable, userId); + } + // 触发与已有实例之间绑定关系的任务 + instanceAutoRelationService.instanceAutoRelation(instance, userId); + // 操作审计 instanceValues = instanceValueRepository.listByInstanceId(instance.getId(), valueTable); instanceValues.forEach(item -> {