From 73acd3fc67a3aa149a29dc4cebebac9ba71a0694 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Wed, 22 May 2024 09:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 33 +++++ hbt-related-parties-api/pom.xml | 28 ++++ .../RemoteRelatedPartiesFallbackFactory.java | 25 ++++ .../api/remoteRelatedPartiesService.java | 23 ++++ hbt-related-parties-biz/Dockerfile | 4 + hbt-related-parties-biz/pom.xml | 126 ++++++++++++++++++ .../parties/RelatedPartiesApplication.java | 23 ++++ .../src/main/resources/banner.txt | 8 ++ .../src/main/resources/bootstrap-dev.yml | 16 +++ .../src/main/resources/bootstrap.yml | 14 ++ .../com/hbt/related/parties/EventTest.java | 18 +++ pom.xml | 126 ++++++++++++++++++ 12 files changed, 444 insertions(+) create mode 100644 .gitignore create mode 100644 hbt-related-parties-api/pom.xml create mode 100644 hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/factory/RemoteRelatedPartiesFallbackFactory.java create mode 100644 hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/remoteRelatedPartiesService.java create mode 100644 hbt-related-parties-biz/Dockerfile create mode 100644 hbt-related-parties-biz/pom.xml create mode 100644 hbt-related-parties-biz/src/main/java/com/hbt/related/parties/RelatedPartiesApplication.java create mode 100644 hbt-related-parties-biz/src/main/resources/banner.txt create mode 100644 hbt-related-parties-biz/src/main/resources/bootstrap-dev.yml create mode 100644 hbt-related-parties-biz/src/main/resources/bootstrap.yml create mode 100644 hbt-related-parties-biz/src/test/java/com/hbt/related/parties/EventTest.java create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff10b09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +*.class +*/logs +.mvn/ +*.md + +#package files + +*.war +*.ear + +#kdiff3 ignore +target/ + +#eclipse ignore +.settings/ +.project +.classpath + +#idea +.idea/ +/idea/ +*.ipr +*.iml +*.iws + +# temp file + +*.log +*.cache +*.diff +*.patch +*.tmp +*.versionsBackup \ No newline at end of file diff --git a/hbt-related-parties-api/pom.xml b/hbt-related-parties-api/pom.xml new file mode 100644 index 0000000..221e519 --- /dev/null +++ b/hbt-related-parties-api/pom.xml @@ -0,0 +1,28 @@ + + + + com.hbt.sass + hbt-related-parties + 1.0-SNAPSHOT + + 4.0.0 + + hbt-related-parties-api + + + + + com.hbt.onreal + hbt-onreal-common-security + + + + joda-time + joda-time + + + + + \ No newline at end of file diff --git a/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/factory/RemoteRelatedPartiesFallbackFactory.java b/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/factory/RemoteRelatedPartiesFallbackFactory.java new file mode 100644 index 0000000..74d70f8 --- /dev/null +++ b/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/factory/RemoteRelatedPartiesFallbackFactory.java @@ -0,0 +1,25 @@ +package com.hbt.related.parties.api.factory; + +import com.hbt.common.core.domain.R; +import com.hbt.related.parties.api.remoteRelatedPartiesService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +/** + * RelatedParties服务降级处理 + * + * @author hbt + */ +@Component +@Slf4j +public class RemoteRelatedPartiesFallbackFactory implements FallbackFactory +{ + + @Override + public remoteRelatedPartiesService create(Throwable throwable) + { + log.error("RelatedParties服务调用失败:{}", throwable.getMessage()); + return () -> R.fail("调用失败:" + throwable.getMessage()); + } +} diff --git a/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/remoteRelatedPartiesService.java b/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/remoteRelatedPartiesService.java new file mode 100644 index 0000000..041a09d --- /dev/null +++ b/hbt-related-parties-api/src/main/java/com/hbt/related/parties/api/remoteRelatedPartiesService.java @@ -0,0 +1,23 @@ +package com.hbt.related.parties.api; + +import com.hbt.common.core.domain.R; +import com.hbt.related.parties.api.factory.RemoteRelatedPartiesFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * hbt-related-parties服务 + * + * @author hbt + */ +@FeignClient(contextId = "remoteRelatedPartiesService", value = "hbt-related-parties", fallbackFactory = RemoteRelatedPartiesFallbackFactory.class) +public interface remoteRelatedPartiesService +{ + /** + * 接口示例 + * + * @return 结果 + */ + @GetMapping(value = "/relatedParties/action") + R action() ; +} diff --git a/hbt-related-parties-biz/Dockerfile b/hbt-related-parties-biz/Dockerfile new file mode 100644 index 0000000..cf9cf5d --- /dev/null +++ b/hbt-related-parties-biz/Dockerfile @@ -0,0 +1,4 @@ +FROM 119.45.158.12:5000/mini-java8:latest +COPY target/hbt-related-parties-biz-1.0-SNAPSHOT.jar /app/app.jar +ENV NACOSIP="" +ENTRYPOINT ["sh","-c","java -Dnacos.ip=$NACOSIP -jar /app/app.jar"] \ No newline at end of file diff --git a/hbt-related-parties-biz/pom.xml b/hbt-related-parties-biz/pom.xml new file mode 100644 index 0000000..74011aa --- /dev/null +++ b/hbt-related-parties-biz/pom.xml @@ -0,0 +1,126 @@ + + + + com.hbt.sass + hbt-related-parties + 1.0-SNAPSHOT + + 4.0.0 + + hbt-related-parties-biz + 1.0-SNAPSHOT + + + + + com.hbt.onreal + hbt-paas-api-bpm + + + + com.sushengren + easyword + 1.1.5 + + + org.apache.poi + poi-ooxml + + + + + org.apache.poi + poi-ooxml + 5.2.2 + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + org.springframework.boot + spring-boot-starter-actuator + + + + com.hbt.onreal + hbt-onreal-common-datasource + + + + com.hbt.onreal + hbt-onreal-common-security + + + + com.hbt.onreal + hbt-onreal-common-swagger + + + + com.hbt.onreal + hbt-onreal-common-log + + + + com.hbt.sass + hbt-corporate-info-api + 1.0-SNAPSHOT + + + + io.springfox + springfox-swagger-ui + + + + mysql + mysql-connector-java + + + + com.hbt.sass + hbt-corporate-info-api + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-test + + + junit + junit + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + \ No newline at end of file diff --git a/hbt-related-parties-biz/src/main/java/com/hbt/related/parties/RelatedPartiesApplication.java b/hbt-related-parties-biz/src/main/java/com/hbt/related/parties/RelatedPartiesApplication.java new file mode 100644 index 0000000..b4e98be --- /dev/null +++ b/hbt-related-parties-biz/src/main/java/com/hbt/related/parties/RelatedPartiesApplication.java @@ -0,0 +1,23 @@ +package com.hbt.related.parties; + +import com.hbt.common.security.annotation.EnableCustomConfig; +import com.hbt.common.security.annotation.EnableRyFeignClients; +import com.hbt.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.cloud.client.SpringCloudApplication; + +/** + * 入口类, 扫描并注入其他配置类和服务 + */ +@EnableCustomConfig +@SpringCloudApplication +@EnableCustomSwagger2 +@EnableRyFeignClients +public class RelatedPartiesApplication { + + public static void main(String[] args) + { + SpringApplication.run(RelatedPartiesApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 相关方管理服务启动成功 ლ(´ڡ`ლ)゙ "); + } +} diff --git a/hbt-related-parties-biz/src/main/resources/banner.txt b/hbt-related-parties-biz/src/main/resources/banner.txt new file mode 100644 index 0000000..76d7384 --- /dev/null +++ b/hbt-related-parties-biz/src/main/resources/banner.txt @@ -0,0 +1,8 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} + _ _ _ + | | | | | | + | |__ | |__ | |_ ______ ___ __ _ ___ ___ + | '_ \| '_ \| __|______/ __| / _` | / __| / __| + | | | | |_) | |_ \__ \ | (_| | \__ \ \__ \ + |_| |_|_.__/ \__| |___/ \__,_| |___/ |___/ diff --git a/hbt-related-parties-biz/src/main/resources/bootstrap-dev.yml b/hbt-related-parties-biz/src/main/resources/bootstrap-dev.yml new file mode 100644 index 0000000..39db42b --- /dev/null +++ b/hbt-related-parties-biz/src/main/resources/bootstrap-dev.yml @@ -0,0 +1,16 @@ +# Spring +spring: + cloud: + nacos: + username: nacos + password: zkhbt888 + discovery: + # 服务注册地址 + server-addr: ${nacos.ip}:8848 + config: + # 配置中心地址 + server-addr: ${nacos.ip}:8848 + # 配置文件格式 + file_extension: yml + # 共享配置 + shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file_extension} diff --git a/hbt-related-parties-biz/src/main/resources/bootstrap.yml b/hbt-related-parties-biz/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..23704a6 --- /dev/null +++ b/hbt-related-parties-biz/src/main/resources/bootstrap.yml @@ -0,0 +1,14 @@ +# Tomcat +server: + port: 9405 +# Spring +spring: + application: + # 应用名称 + name: hbt-related-parties-zy + profiles: + # 环境配置 + active: dev + +nacos: + ip: 192.168.1.211 diff --git a/hbt-related-parties-biz/src/test/java/com/hbt/related/parties/EventTest.java b/hbt-related-parties-biz/src/test/java/com/hbt/related/parties/EventTest.java new file mode 100644 index 0000000..3fccecd --- /dev/null +++ b/hbt-related-parties-biz/src/test/java/com/hbt/related/parties/EventTest.java @@ -0,0 +1,18 @@ +package com.hbt.related.parties; + +import com.alibaba.fastjson2.JSONObject; +import com.hbt.common.core.utils.SpringUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@SpringBootTest +@RunWith(SpringJUnit4ClassRunner.class) +public class EventTest { + + @Autowired + private ApplicationContext applicationContext; +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a43db6a --- /dev/null +++ b/pom.xml @@ -0,0 +1,126 @@ + + + 4.0.0 + + com.hbt.sass + hbt-related-parties + 1.0-SNAPSHOT + hbt-work-ticket + + hbt-related-parties-api + hbt-related-parties-biz + + pom + + + 3.7.0-SNAPSHOT + UTF-8 + UTF-8 + 1.8 + 2.7.7 + + + + + central + https://maven.aliyun.com/repository/public + + false + always + + + true + always + warn + + + + maven-public + http://81.70.119.104:8081/repository/maven-public/ + + false + always + + + true + always + warn + + + + + + maven-public + http://81.70.119.104:8081/repository/maven-public/ + + true + + + true + + + + + + maven-public + http://81.70.119.104:8081/repository/maven-releases/ + + + maven-public + http://81.70.119.104:8081/repository/maven-snapshots/ + + + + + + + + + com.hbt.onreal + hbt-onreal + ${hbt-cloud.version} + pom + import + + + + com.hbt.sass + hbt-related-parties-api + ${project.version} + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + repackage + + + + + + + + \ No newline at end of file