diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceAccountCrossoverMapper.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceAccountCrossoverMapper.java index bcc5073e4f2243913e49ab81c98c58172829ef71..a70ce6d74c619063a302d72ec50a9f376d54f9fc 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceAccountCrossoverMapper.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceAccountCrossoverMapper.java @@ -18,6 +18,7 @@ package neatlogic.framework.cmdb.crossover; import neatlogic.framework.cmdb.dto.resourcecenter.AccountIpVo; import neatlogic.framework.cmdb.dto.resourcecenter.AccountProtocolVo; import neatlogic.framework.cmdb.dto.resourcecenter.AccountVo; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceAccountVo; import neatlogic.framework.crossover.ICrossoverService; import org.apache.ibatis.annotations.Param; @@ -29,6 +30,10 @@ public interface IResourceAccountCrossoverMapper extends ICrossoverService { AccountVo getPublicAccountByName(String name); + List getAccountListByIdList(List accountIdList); + + int checkAccountNameIsRepeats(AccountVo vo); + AccountVo getResourceAccountByIpAndPort(@Param("host") String host, @Param("port") Integer port); AccountVo getAccountByTagentIpAndPort(@Param("ip") String ip, @Param("port") Integer port); @@ -37,6 +42,10 @@ public interface IResourceAccountCrossoverMapper extends ICrossoverService { AccountVo getAccountByTagentId(Long id); + List getResourceAccountListByResourceIdAndType(@Param("resourceId") Long resourceId, @Param("type") String type); + + List getResourceAccountListByResourceId(Long resourceId); + List getAllAccountList(); List getAccountListByIpAndProtocolNameAndAccountAndProtocolPort(@Param("ip") String ip, @Param("protocolName") String protocolName, @Param("account") String account, @Param("protocolPort") Integer protocolPort); @@ -65,6 +74,8 @@ public interface IResourceAccountCrossoverMapper extends ICrossoverService { void insertAccount(AccountVo vo); + int insertIgnoreResourceAccount(List resourceAccountVoList); + int insertAccountProtocol(AccountProtocolVo searchVo); int insertAccountIp(AccountIpVo ipVo); @@ -77,4 +88,6 @@ public interface IResourceAccountCrossoverMapper extends ICrossoverService { int deleteResourceAccountByAccountId(Long accountId); + int deleteResourceAccountByResourceIdListAndAccountIdList(@Param("resourceIdList") List resourceIdList, @Param("accountIdList") List accountIdList); + } diff --git a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterAccountCrossoverService.java b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterAccountCrossoverService.java index b49299b929ef07a604bc5050beeb07808a78b8f4..0f9829c9a1e9e1c9ac08287df8b20d02e3686ffa 100644 --- a/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterAccountCrossoverService.java +++ b/src/main/java/neatlogic/framework/cmdb/crossover/IResourceCenterAccountCrossoverService.java @@ -15,6 +15,7 @@ along with this program. If not, see .*/ package neatlogic.framework.cmdb.crossover; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.cmdb.dto.resourcecenter.AccountBaseVo; import neatlogic.framework.cmdb.dto.resourcecenter.AccountProtocolVo; import neatlogic.framework.cmdb.dto.resourcecenter.AccountVo; @@ -53,4 +54,20 @@ public interface IResourceCenterAccountCrossoverService extends ICrossoverServic * @param accountIdList 账号idList */ void deleteAccount(List accountIdList); + + /** + * 保存账号 + * @param id + * @param paramAccountVo + * @return + */ + JSONObject saveAccount(Long id, AccountVo paramAccountVo); + + /** + * 绑定账号与资源关系 + * @param resourceId + * @param accountIdList + * @return + */ + JSONObject saveResourceAccount(Long resourceId, List accountIdList); } diff --git a/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterAccountNotPrivateException.java b/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterAccountNotPrivateException.java new file mode 100644 index 0000000000000000000000000000000000000000..0577f8f7e10249f5fbc2dda420be07f05acdfa0d --- /dev/null +++ b/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterAccountNotPrivateException.java @@ -0,0 +1,28 @@ +/*Copyright (C) 2023 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.framework.cmdb.exception.resourcecenter; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class ResourceCenterAccountNotPrivateException extends ApiRuntimeException { + + private static final long serialVersionUID = 560397839803209201L; + + public ResourceCenterAccountNotPrivateException(String name) { + super("nfcer.resourcecenteraccountnotprivateexception.resourcecenteraccountnotprivateexception", name); + } + +} diff --git a/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterResourceNotExistAccountException.java b/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterResourceNotExistAccountException.java new file mode 100644 index 0000000000000000000000000000000000000000..0930dba5a504bf08f911dde0e76d0c836d6f26b1 --- /dev/null +++ b/src/main/java/neatlogic/framework/cmdb/exception/resourcecenter/ResourceCenterResourceNotExistAccountException.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2025 深圳极向量科技有限公司 All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package neatlogic.framework.cmdb.exception.resourcecenter; + +import neatlogic.framework.exception.core.ApiRuntimeException; + +public class ResourceCenterResourceNotExistAccountException extends ApiRuntimeException { + + private static final long serialVersionUID = 560397839803209203L; + + public ResourceCenterResourceNotExistAccountException(String resourceName, String accountName) { + super("nfcer.resourcecenterresourcenotexistaccountexception.resourcecenterresourcenotexistaccountexception", resourceName, accountName); + } +}