From b7be97f7ae284dff4356d872683759c8fff14016 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Tue, 13 Aug 2024 15:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=89=93=E5=8C=85?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E6=97=B6=E5=B0=86=E9=80=82=E9=85=8D=E5=99=A8?= =?UTF-8?q?=E4=B9=9F=E8=BF=9B=E8=A1=8C=E6=89=93=E5=8C=85=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=B0core=E9=A1=B9=E7=9B=AE=E4=B8=AD?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .mvn/maven.config | 1 + README.md | 2 +- .../deploy/ease/api/base/BaseResponse.java | 15 +++ .../ease/api/controller/INacosController.java | 6 + .../ease/api/response/TenantResponse.java | 17 +++ deploy-ease-core/pom.xml | 115 +++++++++++++++++- .../deploy/ease/DeployEaseApplication.java | 10 ++ .../qc/soft/deploy/ease/consts/Consts.java | 6 + .../ease/controller/NacosController.java | 5 - .../DictionaryConvert.java} | 6 +- .../ProjectConvert.java} | 6 +- .../ease/convert/response/TenantConvert.java | 20 +++ .../TenantDictionaryConvert.java} | 6 +- .../deploy/ease/service/ITenantService.java | 11 ++ .../service/impl/DictionaryServiceImpl.java | 11 +- .../ease/service/impl/NacosServiceImpl.java | 16 ++- .../ease/service/impl/ProjectServiceImpl.java | 4 +- .../ease/service/impl/TenantServiceImpl.java | 32 +++++ .../src/main/resources/bootstrap.yml | 8 +- deploy-ease-synchronizer/pom.xml | 113 ----------------- .../DeployEaseSynchronizerApplication.java | 18 --- .../src/main/resources/application.yml | 0 .../src/main/resources/bootstrap.yml | 27 ---- pom.xml | 32 +++-- 24 files changed, 283 insertions(+), 204 deletions(-) create mode 100644 .mvn/maven.config create mode 100644 deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/base/BaseResponse.java create mode 100644 deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/response/TenantResponse.java create mode 100644 deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/consts/Consts.java rename deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/{api/response/DictionaryApiResponseConvert.java => response/DictionaryConvert.java} (59%) rename deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/{api/response/ProjectApiResponseConvert.java => response/ProjectConvert.java} (59%) create mode 100644 deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantConvert.java rename deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/{api/response/TenantDictionaryApiResponseConvert.java => response/TenantDictionaryConvert.java} (59%) create mode 100644 deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/ITenantService.java create mode 100644 deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/TenantServiceImpl.java delete mode 100644 deploy-ease-synchronizer/pom.xml delete mode 100644 deploy-ease-synchronizer/src/main/java/com/qc/soft/deploy/ease/synchronizer/DeployEaseSynchronizerApplication.java delete mode 100644 deploy-ease-synchronizer/src/main/resources/application.yml delete mode 100644 deploy-ease-synchronizer/src/main/resources/bootstrap.yml diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..9b1795b --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +-Dadapter-revision=1.0.0 \ No newline at end of file diff --git a/README.md b/README.md index c4410ba..50aa1af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 启动参数 ```` --DNACOS_CONFIG_SERVER=192.168.105.1:8848 +-DNACOS_CONFIG_SERVER=192.168.0.166:8848 -DTENANT_CODE=longi -DDEPLOY_ENV=deploy-ease-dev -DNACOS_USER=nacos diff --git a/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/base/BaseResponse.java b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/base/BaseResponse.java new file mode 100644 index 0000000..2eb772a --- /dev/null +++ b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/base/BaseResponse.java @@ -0,0 +1,15 @@ +package com.qc.soft.deploy.ease.api.base; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +public abstract class BaseResponse implements Serializable { + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private Boolean isDeleted; + +} diff --git a/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/controller/INacosController.java b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/controller/INacosController.java index 29fc884..208a307 100644 --- a/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/controller/INacosController.java +++ b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/controller/INacosController.java @@ -1,9 +1,15 @@ package com.qc.soft.deploy.ease.api.controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +@RestController +@RequestMapping("/deploy-ease/nacos") public interface INacosController { + @GetMapping("/instances") void instances(); } diff --git a/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/response/TenantResponse.java b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/response/TenantResponse.java new file mode 100644 index 0000000..f65abf5 --- /dev/null +++ b/deploy-ease-api/src/main/java/com/qc/soft/deploy/ease/api/response/TenantResponse.java @@ -0,0 +1,17 @@ +package com.qc.soft.deploy.ease.api.response; + +import com.qc.soft.deploy.ease.api.base.BaseResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class TenantResponse extends BaseResponse { + + private String tenantCode; + + private String tenantName; + + private boolean enabled; + +} \ No newline at end of file diff --git a/deploy-ease-core/pom.xml b/deploy-ease-core/pom.xml index 67283f4..c1f5f1e 100644 --- a/deploy-ease-core/pom.xml +++ b/deploy-ease-core/pom.xml @@ -128,6 +128,11 @@ deploy-ease-api 1.0-SNAPSHOT + + com.qc.soft + deploy-ease-tenant-adapter + provided + com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery @@ -142,11 +147,119 @@ + + + + + org.codehaus.mojo + flatten-maven-plugin + ${flatten-maven-plugin.version} + + true + resolveCiFriendliesOnly + + + + flatten + process-resources + + flatten + + + + flatten-clean + clean + + clean + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + build-tenant-adapter + initialize + + exec + + + mvn + ${project.basedir}/../deploy-ease-tenant-adapter + + clean + install + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + ${maven-antrun-plugin.version} + + + copy-tenant-adapter + generate-sources + + run + + + + + + + /> + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + false + false + + + com.qc.soft + deploy-ease-tenant-adapter + + + + + + + repackage + + + + + + + + src/main/resources + + + ${project.build.directory}/BOOT-INF/lib + BOOT-INF/lib/ + + *.jar + + + + com.qc.soft deploy-ease 1.0-SNAPSHOT - \ No newline at end of file diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/DeployEaseApplication.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/DeployEaseApplication.java index 0611331..7ec9ec3 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/DeployEaseApplication.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/DeployEaseApplication.java @@ -6,6 +6,9 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableAsync; +import java.net.URL; +import java.net.URLClassLoader; + @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan("com.qc.soft.deploy.ease.*") @@ -15,6 +18,13 @@ import org.springframework.scheduling.annotation.EnableAsync; public class DeployEaseApplication { public static void main(String[] args) { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + if (classLoader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader) classLoader).getURLs(); + for (URL url : urls) { + System.out.println(url.getFile()); + } + } SpringApplication.run(DeployEaseApplication.class, args); } } diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/consts/Consts.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/consts/Consts.java new file mode 100644 index 0000000..ab05923 --- /dev/null +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/consts/Consts.java @@ -0,0 +1,6 @@ +package com.qc.soft.deploy.ease.consts; + +public class Consts { + public static final String TENANT_ADAPTER_SERVICE_NAME = "deploy-ease-adapter-%s"; + +} diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/controller/NacosController.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/controller/NacosController.java index f53f955..0323682 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/controller/NacosController.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/controller/NacosController.java @@ -2,15 +2,11 @@ package com.qc.soft.deploy.ease.controller; import com.qc.soft.deploy.ease.api.controller.INacosController; import com.qc.soft.deploy.ease.service.INacosService; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController -@RequestMapping("/deploy-ease/nacos") public class NacosController implements INacosController { @@ -19,7 +15,6 @@ public class NacosController implements INacosController { @Override - @GetMapping("/instances") public void instances() { nacosService.instances(); } diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/DictionaryApiResponseConvert.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/DictionaryConvert.java similarity index 59% rename from deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/DictionaryApiResponseConvert.java rename to deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/DictionaryConvert.java index 57bb953..02b23c7 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/DictionaryApiResponseConvert.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/DictionaryConvert.java @@ -1,4 +1,4 @@ -package com.qc.soft.deploy.ease.convert.api.response; +package com.qc.soft.deploy.ease.convert.response; import com.qc.soft.deploy.ease.api.response.DictionaryResponse; import com.qc.soft.deploy.ease.entity.Dictionary; @@ -8,9 +8,9 @@ import org.mapstruct.factory.Mappers; import java.util.List; @Mapper -public interface DictionaryApiResponseConvert { +public interface DictionaryConvert { - DictionaryApiResponseConvert INSTANCE = Mappers.getMapper(DictionaryApiResponseConvert.class); + DictionaryConvert INSTANCE = Mappers.getMapper(DictionaryConvert.class); List entityToResponse(List dictionaries); diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/ProjectApiResponseConvert.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/ProjectConvert.java similarity index 59% rename from deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/ProjectApiResponseConvert.java rename to deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/ProjectConvert.java index b426aaa..886c2a2 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/ProjectApiResponseConvert.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/ProjectConvert.java @@ -1,4 +1,4 @@ -package com.qc.soft.deploy.ease.convert.api.response; +package com.qc.soft.deploy.ease.convert.response; import com.qc.soft.deploy.ease.api.response.ProjectResponse; import com.qc.soft.deploy.ease.entity.Project; @@ -8,9 +8,9 @@ import org.mapstruct.factory.Mappers; import java.util.List; @Mapper -public interface ProjectApiResponseConvert { +public interface ProjectConvert { - ProjectApiResponseConvert INSTANCE = Mappers.getMapper(ProjectApiResponseConvert.class); + ProjectConvert INSTANCE = Mappers.getMapper(ProjectConvert.class); List entityToResponse(List projects); diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantConvert.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantConvert.java new file mode 100644 index 0000000..e12dc47 --- /dev/null +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantConvert.java @@ -0,0 +1,20 @@ +package com.qc.soft.deploy.ease.convert.response; + +import com.qc.soft.deploy.ease.api.response.TenantDictionaryResponse; +import com.qc.soft.deploy.ease.api.response.TenantResponse; +import com.qc.soft.deploy.ease.entity.Tenant; +import com.qc.soft.deploy.ease.entity.TenantDictionary; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface TenantConvert { + + TenantConvert INSTANCE = Mappers.getMapper(TenantConvert.class); + + + List listToResponse(List tenants); + +} diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/TenantDictionaryApiResponseConvert.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantDictionaryConvert.java similarity index 59% rename from deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/TenantDictionaryApiResponseConvert.java rename to deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantDictionaryConvert.java index 09bbc74..0eadc3e 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/api/response/TenantDictionaryApiResponseConvert.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/convert/response/TenantDictionaryConvert.java @@ -1,4 +1,4 @@ -package com.qc.soft.deploy.ease.convert.api.response; +package com.qc.soft.deploy.ease.convert.response; import com.qc.soft.deploy.ease.api.response.TenantDictionaryResponse; import com.qc.soft.deploy.ease.entity.TenantDictionary; @@ -8,9 +8,9 @@ import org.mapstruct.factory.Mappers; import java.util.List; @Mapper -public interface TenantDictionaryApiResponseConvert { +public interface TenantDictionaryConvert { - TenantDictionaryApiResponseConvert INSTANCE = Mappers.getMapper(TenantDictionaryApiResponseConvert.class); + TenantDictionaryConvert INSTANCE = Mappers.getMapper(TenantDictionaryConvert.class); List entityToResponse(List dictionaries); diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/ITenantService.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/ITenantService.java new file mode 100644 index 0000000..09b0060 --- /dev/null +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/ITenantService.java @@ -0,0 +1,11 @@ +package com.qc.soft.deploy.ease.service; + +import com.qc.soft.deploy.ease.api.response.ProjectResponse; +import com.qc.soft.deploy.ease.api.response.TenantResponse; + +import java.util.List; + +public interface ITenantService { + + List tenants(); +} \ No newline at end of file diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/DictionaryServiceImpl.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/DictionaryServiceImpl.java index 9dd60cc..07c11f3 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/DictionaryServiceImpl.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/DictionaryServiceImpl.java @@ -3,9 +3,8 @@ package com.qc.soft.deploy.ease.service.impl; import com.qc.soft.deploy.ease.api.response.DictionaryResponse; import com.qc.soft.deploy.ease.api.response.TenantDictionaryResponse; import com.qc.soft.deploy.ease.context.TenantContext; -import com.qc.soft.deploy.ease.convert.api.response.DictionaryApiResponseConvert; -import com.qc.soft.deploy.ease.convert.api.response.TenantDictionaryApiResponseConvert; -import com.qc.soft.deploy.ease.convert.dto.DictionaryConvert; +import com.qc.soft.deploy.ease.convert.response.DictionaryConvert; +import com.qc.soft.deploy.ease.convert.response.TenantDictionaryConvert; import com.qc.soft.deploy.ease.entity.Dictionary; import com.qc.soft.deploy.ease.entity.TenantDictionary; import com.qc.soft.deploy.ease.repository.IDictionaryRepository; @@ -32,7 +31,7 @@ public class DictionaryServiceImpl implements IDictionaryService { @Override public List findSystemDicts() { - return DictionaryApiResponseConvert.INSTANCE.entityToResponse(dictionaryRepository.findAll()); + return DictionaryConvert.INSTANCE.entityToResponse(dictionaryRepository.findAll()); } @Override @@ -46,10 +45,10 @@ public class DictionaryServiceImpl implements IDictionaryService { Map tenantDictMap = tenantDict.stream().collect(Collectors.toMap(TenantDictionary::getCode, tenantDictionary -> tenantDictionary)); TenantDictionary tenantDictionary = tenantDictMap.get(systemDictCode); if (tenantDictionary == null) { - tenantDictMap.put(systemDictCode, DictionaryConvert.INSTANCE.systemDictionaryToTenantDictionary(v)); + tenantDictMap.put(systemDictCode, com.qc.soft.deploy.ease.convert.dto.DictionaryConvert.INSTANCE.systemDictionaryToTenantDictionary(v)); } mergeTenantDict.addAll(tenantDictMap.values()); }); - return TenantDictionaryApiResponseConvert.INSTANCE.entityToResponse(mergeTenantDict); + return TenantDictionaryConvert.INSTANCE.entityToResponse(mergeTenantDict); } } diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/NacosServiceImpl.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/NacosServiceImpl.java index 5aca0f3..e744c40 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/NacosServiceImpl.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/NacosServiceImpl.java @@ -5,7 +5,10 @@ import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingFactory; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; +import com.qc.soft.deploy.ease.api.response.TenantResponse; +import com.qc.soft.deploy.ease.consts.Consts; import com.qc.soft.deploy.ease.service.INacosService; +import com.qc.soft.deploy.ease.service.ITenantService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -17,14 +20,19 @@ public class NacosServiceImpl implements INacosService { @Resource private NacosDiscoveryProperties nacosDiscoveryProperties; - private final static String SYNCHRONIZER_SERVICE_NAME = "deploy-ease-synchronizer-longi-%s"; + @Resource + private ITenantService tenantService; + + @Override public void instances() { try { - NamingService namingService = NamingFactory.createNamingService(nacosDiscoveryProperties.getNacosProperties()); - List allInstances = namingService.getAllInstances(SYNCHRONIZER_SERVICE_NAME, nacosDiscoveryProperties.getGroup()); - System.out.println(allInstances); + List tenants = tenantService.tenants(); + for (TenantResponse tenantResponse : tenants) { + List instances = namingService.getAllInstances(String.format(Consts.TENANT_ADAPTER_SERVICE_NAME, tenantResponse.getTenantCode()), nacosDiscoveryProperties.getGroup()); + System.out.println(instances); + } } catch (NacosException e) { throw new RuntimeException(e); } diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/ProjectServiceImpl.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/ProjectServiceImpl.java index 59e8002..b26880c 100644 --- a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/ProjectServiceImpl.java +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/ProjectServiceImpl.java @@ -2,7 +2,7 @@ package com.qc.soft.deploy.ease.service.impl; import com.qc.soft.deploy.ease.api.response.ProjectResponse; import com.qc.soft.deploy.ease.context.TenantContext; -import com.qc.soft.deploy.ease.convert.api.response.ProjectApiResponseConvert; +import com.qc.soft.deploy.ease.convert.response.ProjectConvert; import com.qc.soft.deploy.ease.repository.IProjectRepository; import com.qc.soft.deploy.ease.service.IProjectService; import org.springframework.stereotype.Service; @@ -20,6 +20,6 @@ public class ProjectServiceImpl implements IProjectService { @Override public List list() { String tenantCode = TenantContext.getCurrentTenant(); - return ProjectApiResponseConvert.INSTANCE.entityToResponse(projectRepository.findByTenantCode(tenantCode)); + return ProjectConvert.INSTANCE.entityToResponse(projectRepository.findByTenantCode(tenantCode)); } } diff --git a/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/TenantServiceImpl.java b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/TenantServiceImpl.java new file mode 100644 index 0000000..3cdc5e2 --- /dev/null +++ b/deploy-ease-core/src/main/java/com/qc/soft/deploy/ease/service/impl/TenantServiceImpl.java @@ -0,0 +1,32 @@ +package com.qc.soft.deploy.ease.service.impl; + +import com.qc.soft.deploy.ease.api.response.TenantResponse; +import com.qc.soft.deploy.ease.convert.response.TenantConvert; +import com.qc.soft.deploy.ease.holder.K8sApiHolder; +import com.qc.soft.deploy.ease.k8s.K8sDeploymentResponse; +import com.qc.soft.deploy.ease.k8s.K8sNamespaceResponse; +import com.qc.soft.deploy.ease.k8s.K8sPodResponse; +import com.qc.soft.deploy.ease.repository.ITenantRepository; +import com.qc.soft.deploy.ease.service.IK8sService; +import com.qc.soft.deploy.ease.service.ITenantService; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class TenantServiceImpl implements ITenantService { + + @Resource + private ITenantRepository tenantRepository; + @Override + public List tenants() { + return TenantConvert.INSTANCE.listToResponse(tenantRepository.findAll()); + } +} \ No newline at end of file diff --git a/deploy-ease-core/src/main/resources/bootstrap.yml b/deploy-ease-core/src/main/resources/bootstrap.yml index 9ad47f6..2454c26 100644 --- a/deploy-ease-core/src/main/resources/bootstrap.yml +++ b/deploy-ease-core/src/main/resources/bootstrap.yml @@ -1,18 +1,16 @@ spring: cloud: nacos: - server-addr: ${NACOS_CONFIG_SERVER:192.168.105.1:8848} + server-addr: ${NACOS_CONFIG_SERVER:192.168.0.166:8848} + username: ${NACOS_USER} + password: ${NACOS_PWD} discovery: group: ${DEPLOY_ENV} namespace: ${DEPLOY_ENV} - username: ${NACOS_USER} - password: ${NACOS_PWD} enabled: true config: group: ${DEPLOY_ENV} namespace: ${DEPLOY_ENV} - username: ${NACOS_USER} - password: ${NACOS_PWD} extension-configs[0]: data-id: common.yml group: common diff --git a/deploy-ease-synchronizer/pom.xml b/deploy-ease-synchronizer/pom.xml deleted file mode 100644 index 1457798..0000000 --- a/deploy-ease-synchronizer/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - 4.0.0 - deploy-ease-synchronizer - - - - - org.springframework.boot - spring-boot - - - org.springframework.boot - spring-boot-starter-webflux - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-web - - - org.projectlombok - lombok - ${lombok.version} - provided - - - com.alibaba - transmittable-thread-local - ${transmittable-thread-local.version} - - - org.apache.httpcomponents.client5 - httpclient5 - ${http5.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - cn.hutool - hutool-all - ${hutool.version} - - - io.kubernetes - client-java - ${kubernetes.version} - - - org.freemarker - freemarker - ${freemarker.version} - - - com.alibaba.fastjson2 - fastjson2 - ${fastjson-version} - - - com.squareup.okhttp3 - okhttp - ${okhttp3.version} - - - org.mapstruct - mapstruct - ${mapstruct.version} - - - org.mapstruct - mapstruct-processor - ${mapstruct.version} - - - org.mapstruct - mapstruct-jdk8 - ${mapstruct.version} - - - com.qc.soft - deploy-ease-api - 1.0-SNAPSHOT - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-config - - - com.alibaba.nacos - nacos-client - - - - - - com.qc.soft - deploy-ease - 1.0-SNAPSHOT - - - \ No newline at end of file diff --git a/deploy-ease-synchronizer/src/main/java/com/qc/soft/deploy/ease/synchronizer/DeployEaseSynchronizerApplication.java b/deploy-ease-synchronizer/src/main/java/com/qc/soft/deploy/ease/synchronizer/DeployEaseSynchronizerApplication.java deleted file mode 100644 index d9358c1..0000000 --- a/deploy-ease-synchronizer/src/main/java/com/qc/soft/deploy/ease/synchronizer/DeployEaseSynchronizerApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.qc.soft.deploy.ease.synchronizer; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; - -@SpringBootConfiguration -@EnableAutoConfiguration -@EnableScheduling -@EnableAsync -public class DeployEaseSynchronizerApplication { - - public static void main(String[] args) { - SpringApplication.run(DeployEaseSynchronizerApplication.class, args); - } -} diff --git a/deploy-ease-synchronizer/src/main/resources/application.yml b/deploy-ease-synchronizer/src/main/resources/application.yml deleted file mode 100644 index e69de29..0000000 diff --git a/deploy-ease-synchronizer/src/main/resources/bootstrap.yml b/deploy-ease-synchronizer/src/main/resources/bootstrap.yml deleted file mode 100644 index 3ac7ca3..0000000 --- a/deploy-ease-synchronizer/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,27 +0,0 @@ -spring: - cloud: - nacos: - server-addr: ${NACOS_CONFIG_SERVER} - username: ${NACOS_USER} - password: ${NACOS_PWD} - discovery: - group: ${DEPLOY_ENV} - namespace: ${DEPLOY_ENV} - enabled: true - config: - group: ${DEPLOY_ENV} - namespace: ${DEPLOY_ENV} - extension-configs[0]: - data-id: common.yml - group: common - refresh: false - extension-configs[1]: - data-id: deploy-ease-synchronizer.yml - group: business - refresh: false - config: - override-none: false - allow-override: true - override-system-properties: false - main: - allow-bean-definition-overriding: true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5de6cbe..d6a1706 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,7 @@ pom + ${adapter-revision} 8 8 UTF-8 @@ -29,6 +30,8 @@ 4.9.1 2.3.0 2.2.9.RELEASE + 1.6.0 + 3.1.0 @@ -60,29 +63,32 @@ nacos-client ${nacos-client.version} + + com.qc.soft + deploy-ease-tenant-adapter + ${deploy-ease-tenant-adapter.version} + + deploy-ease-core deploy-ease-api - deploy-ease-synchronizer + deploy-ease-tenant-adapter + + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.0 + + + - - org.springframework.boot - spring-boot-maven-plugin - 2.6.0 - - - - repackage - - - - \ No newline at end of file