From 37694ebf519ca56e8bb338cacc30f18118930a3b Mon Sep 17 00:00:00 2001 From: yujt Date: Sat, 9 May 2020 09:37:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A6=86=E5=B1=B1=E7=89=A9=E4=B8=9Aserver?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 29 ++ epdc-cloud-property/Dockerfile | 20 ++ epdc-cloud-property/pom.xml | 306 ++++++++++++++++++ .../elink/esua/epdc/PropertyApplication.java | 31 ++ .../esua/epdc/config/ModuleConfigImpl.java | 26 ++ .../elink/esua/epdc/config/ThreadConfig.java | 42 +++ .../com/elink/esua/epdc/modules/epdc.gitkeep | 0 .../src/main/resources/application.yml | 123 +++++++ .../main/resources/i18n/messages.properties | 0 .../resources/i18n/messages_en_US.properties | 0 .../resources/i18n/messages_zh_CN.properties | 0 .../resources/i18n/messages_zh_TW.properties | 0 .../main/resources/i18n/validation.properties | 0 .../i18n/validation_en_US.properties | 0 .../i18n/validation_zh_CN.properties | 0 .../i18n/validation_zh_TW.properties | 0 .../src/main/resources/logback-spring.xml | 162 ++++++++++ .../src/main/resources/mapper/epdc.gitkeep | 0 .../src/main/resources/registry.conf | 21 ++ 19 files changed, 760 insertions(+) create mode 100644 .gitignore create mode 100644 epdc-cloud-property/Dockerfile create mode 100644 epdc-cloud-property/pom.xml create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/PropertyApplication.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ThreadConfig.java create mode 100644 epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/epdc.gitkeep create mode 100644 epdc-cloud-property/src/main/resources/application.yml create mode 100644 epdc-cloud-property/src/main/resources/i18n/messages.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/messages_en_US.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/messages_zh_CN.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/messages_zh_TW.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/validation.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/validation_en_US.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/validation_zh_CN.properties create mode 100644 epdc-cloud-property/src/main/resources/i18n/validation_zh_TW.properties create mode 100644 epdc-cloud-property/src/main/resources/logback-spring.xml create mode 100644 epdc-cloud-property/src/main/resources/mapper/epdc.gitkeep create mode 100644 epdc-cloud-property/src/main/resources/registry.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..281336c --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Created by .ignore support plugin (hsz.mobi) +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +.idea/ +*.iml +**/target/ + diff --git a/epdc-cloud-property/Dockerfile b/epdc-cloud-property/Dockerfile new file mode 100644 index 0000000..fc459b9 --- /dev/null +++ b/epdc-cloud-property/Dockerfile @@ -0,0 +1,20 @@ +# 基础镜像 +FROM openjdk:8u242-jdk-buster +# 作者 +MAINTAINER rongchao@elink-cn.com +# 对应pom.xml文件中的dockerfile-maven-plugin插件JAR_FILE的值 +ARG JAR_FILE +# 对应pom.xml文件中的dockerfile-maven-plugin插件JAR_NAME的值 +ARG JAR_NAME +# 对应pom.xml文件中的dockerfile-maven-plugin插件SERVER_PORT的值 +ARG SERVER_PORT +# 复制打包完成后的jar文件到/opt目录下 +ENV JAR_PATH /mnt/epdc/${JAR_NAME}.jar +ADD ${JAR_FILE} $JAR_PATH +# /data设为环境变量 +ENV DATAPATH /data +# 挂载/data目录到主机 +VOLUME $DATAPATH +# 启动容器时执行 +ENTRYPOINT java -jar $JAR_CONFIG $JAR_PATH +EXPOSE ${SERVER_PORT} diff --git a/epdc-cloud-property/pom.xml b/epdc-cloud-property/pom.xml new file mode 100644 index 0000000..d3fe3cf --- /dev/null +++ b/epdc-cloud-property/pom.xml @@ -0,0 +1,306 @@ + + + 4.0.0 + + + com.esua.epdc.yushan + epdc-cloud-parent-yushan + 1.0.0 + ../epdc-cloud-parent-yushan + + + epdc-cloud-property + jar + 市北党群e家微服务物业服务 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework + spring-context-support + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + io.github.openfeign + feign-httpclient + + + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.0.3 + + + + + com.esua.epdc.yushan + epdc-cloud-admin-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-kpi-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-user-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-property-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-message-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-news-client + ${epdc-cloud-client.version} + + + com.esua.epdc.yushan + epdc-cloud-websocket-client + ${epdc-cloud-client.version} + + + + + + com.esua.epdc.yushan + epdc-commons-tools + 1.0.0 + + + + com.esua.epdc.yushan + epdc-commons-mybatis + ${epdc-cloud-commons.version} + + + + com.esua.epdc.yushan + epdc-commons-tools-wx-ma + ${epdc-cloud-commons.version} + + + + + com.esua.epdc.yushan + epdc-commons-api-version-control + ${epdc-cloud-commons.version} + + + + + + + + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + com.spotify + dockerfile-maven-plugin + + + + ${project.basedir}/src/main/java + + + + true + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + ${basedir}/src/main/resources + + **/application*.yml + **/*.properties + logback-spring.xml + registry.conf + + + + + + + + + dev + + true + + + dev + dev + + 9066 + + 2 + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink833066 + + false + 47.104.224.45:8848 + + 6a3577b4-7b79-43f6-aebb-9c3f31263f6a + + + wxdd8530c5f4926766 + 5bf4fb813145431b3493a10aa7e041e9 + + wx29b074840ef4bfd9 + 4adb1afccc69f205cdf5b521d74e2aca + + wx9b6102a8ee5add65 + 394f47d4e08fc0fd629231d3f68a34dc + + 47.104.85.99:9876;114.215.125.123:9876 + organizationGroup + categoryGroup + categoryGroup + + + + + test + + test + test + + 10006 + + 2 + 114.215.125.123 + 9603 + epdc!redis@master1405 + + + + + epdc + elink833066 + + true + 47.104.224.45:8848 + 47.104.85.99 + 6a3577b4-7b79-43f6-aebb-9c3f31263f6a + + + + + + + wx5d3e97461d248397 + bfed51b731e53db9affb9e6131e7ae12 + + wx9f20a46906ab2c3e + dc13065f79429979d9f687d249eb5c4e + + wx9b6102a8ee5add65 + 394f47d4e08fc0fd629231d3f68a34dc + + 47.104.85.99:9876;114.215.125.123:9876 + organizationGroup + categoryGroup + categoryGroup + + + + + prod + + prod + prod + + 9066 + + + 0 + 172.16.1.243 + 6379 + Elink833066 + + + + + epdc + Elink@833066 + + true + 172.16.1.243:8848 + + + + + wx50ebeb95943868cd + c2719c261fe87b3e2d572552d2c8275d + + wx9f20a46906ab2c3e + dc13065f79429979d9f687d249eb5c4e + + wx9b6102a8ee5add65 + 394f47d4e08fc0fd629231d3f68a34dc + + 172.16.1.242:9876;172.16.1.243:9876 + organizationGroup + categoryGroup + categoryGroup + + + + + diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/PropertyApplication.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/PropertyApplication.java new file mode 100644 index 0000000..07966d3 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/PropertyApplication.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * 物业模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.1.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class PropertyApplication { + + public static void main(String[] args) { + SpringApplication.run(PropertyApplication.class, args); + } + +} diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java new file mode 100644 index 0000000..c24e46b --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.config; + +import com.elink.esua.epdc.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-物业模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "property"; + } +} diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ThreadConfig.java b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ThreadConfig.java new file mode 100644 index 0000000..589e6e9 --- /dev/null +++ b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/config/ThreadConfig.java @@ -0,0 +1,42 @@ +package com.elink.esua.epdc.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.task.TaskExecutor; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 线程池 + * + * @author rongchao + * @Date 18-11-27 + */ +@Configuration +@EnableAsync +public class ThreadConfig { + + @Bean + public TaskExecutor taskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + // 设置核心线程数 + executor.setCorePoolSize(5); + // 设置最大线程数 + executor.setMaxPoolSize(10); + // 设置队列容量 + executor.setQueueCapacity(20); + // 设置线程活跃时间(秒) + executor.setKeepAliveSeconds(60); + // 设置默认线程名称 + executor.setThreadNamePrefix("esd-"); + // 设置拒绝策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + // 等待所有任务结束后再关闭线程池 + executor.setWaitForTasksToCompleteOnShutdown(true); + executor.setAwaitTerminationSeconds(60); + executor.initialize(); + return executor; + } +} diff --git a/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/epdc.gitkeep b/epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/epdc.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/application.yml b/epdc-cloud-property/src/main/resources/application.yml new file mode 100644 index 0000000..d1f1a8d --- /dev/null +++ b/epdc-cloud-property/src/main/resources/application.yml @@ -0,0 +1,123 @@ +server: + port: @server.port@ + servlet: + context-path: /property + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epdc-property-server + # 环境 dev|test|prod + profiles: + active: @spring.profiles.active@ + messages: + encoding: UTF-8 + basename: i18n/messages,i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + timeout: 30s + port: @spring.redis.port@ + password: @spring.redis.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + namespace: @nacos.namespace@ + alibaba: + seata: + tx-service-group: epdc-property-project-server-fescar-service-group + datasource: + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + +feign: + hystrix: + enabled: true + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 + +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.elink.esua.epdc.modules.*.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: UUID + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +wx: + ma: + configs: + - appid: @wx.ma.appId@ + secret: @wx.ma.secret@ + token: #微信小程序消息服务器配置的token + aesKey: #微信小程序消息服务器配置的EncodingAESKey + msgDataFormat: JSON + - appid: @work.wx.ma.appId@ + secret: @work.wx.ma.secret@ + token: #微信小程序消息服务器配置的token + aesKey: #微信小程序消息服务器配置的EncodingAESKey + msgDataFormat: JSON + - appid: @analysis.wx.ma.appId@ + secret: @analysis.wx.ma.secret@ + token: #微信小程序消息服务器配置的token + aesKey: #微信小程序消息服务器配置的EncodingAESKey + msgDataFormat: JSON + appId: + # 普通居民端的appId + normal: @wx.ma.appId@ + # 工作端的appId + work: @work.wx.ma.appId@ + # 数据分析端的appId + analysis: @analysis.wx.ma.appId@ + +rocketmq: + name-server: @rocketmq.name.server@ + producer: + group: @rocketmq.producer.category.group@ + consumer: + group: @rocketmq.consumer.group@ + category-group: @rocketmq.consumer.category.group@ diff --git a/epdc-cloud-property/src/main/resources/i18n/messages.properties b/epdc-cloud-property/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/messages_en_US.properties b/epdc-cloud-property/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/messages_zh_CN.properties b/epdc-cloud-property/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/messages_zh_TW.properties b/epdc-cloud-property/src/main/resources/i18n/messages_zh_TW.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/validation.properties b/epdc-cloud-property/src/main/resources/i18n/validation.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/validation_en_US.properties b/epdc-cloud-property/src/main/resources/i18n/validation_en_US.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/validation_zh_CN.properties b/epdc-cloud-property/src/main/resources/i18n/validation_zh_CN.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/i18n/validation_zh_TW.properties b/epdc-cloud-property/src/main/resources/i18n/validation_zh_TW.properties new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/logback-spring.xml b/epdc-cloud-property/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..9d46c7a --- /dev/null +++ b/epdc-cloud-property/src/main/resources/logback-spring.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epdc-cloud-property/src/main/resources/mapper/epdc.gitkeep b/epdc-cloud-property/src/main/resources/mapper/epdc.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/epdc-cloud-property/src/main/resources/registry.conf b/epdc-cloud-property/src/main/resources/registry.conf new file mode 100644 index 0000000..b5f0898 --- /dev/null +++ b/epdc-cloud-property/src/main/resources/registry.conf @@ -0,0 +1,21 @@ +registry { + # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "@nacos.namespace@" + cluster = "default" + } +} + +config { + # file、nacos 、apollo、zk、consul、etcd3 + type = "nacos" + + nacos { + serverAddr = "@nacos.server-addr@" + namespace = "@nacos.namespace@" + cluster = "default" + } +}