73 changed files with 1926 additions and 17 deletions
			
			
		| @ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <parent> | |||
|         <artifactId>gov-issue</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-issue-client</artifactId> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-tools</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|     </dependencies> | |||
| </project> | |||
| @ -0,0 +1,21 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Description 测试入参 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/8 10:00 | |||
|  */ | |||
| @Data | |||
| public class DemoTestFormDTO implements Serializable { | |||
|     private static final long serialVersionUID = 4859779755214502427L; | |||
|     @NotBlank(message = "客户id不能为空") | |||
|     private String customerId; | |||
|     @NotBlank(message = "网格id不能为空") | |||
|     private String gridId; | |||
| } | |||
| 
 | |||
| @ -0,0 +1,11 @@ | |||
| FROM java:8 | |||
| 
 | |||
| RUN export LANG="zh_CN.UTF-8" | |||
| RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
| RUN echo 'Asia/Shanghai' > /etc/timezone | |||
| 
 | |||
| COPY ./target/*.jar ./app.jar | |||
| 
 | |||
| EXPOSE 8101 | |||
| 
 | |||
| ENTRYPOINT ["java","-Xms32m","-Xmx200m","-jar","./app.jar"] | |||
| @ -0,0 +1,15 @@ | |||
| version: "3.7" | |||
| services: | |||
|   gov-issue-server: | |||
|     container_name: gov-issue-server-dev | |||
|     image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-issue-server:0.3.0 | |||
|     ports: | |||
|       - "8101:8101" | |||
|     network_mode: host # 使用现有网络 | |||
|     volumes: | |||
|       - "/opt/epmet-cloud-logs/dev:/logs" | |||
|     deploy: | |||
|       resources: | |||
|         limits: | |||
|           cpus: '0.1' | |||
|           memory: 250M | |||
| @ -0,0 +1,182 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <version>0.3.0</version> | |||
|     <parent> | |||
|         <artifactId>gov-issue</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-issue-server</artifactId> | |||
|     <packaging>jar</packaging> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>gov-issue-client</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-tools</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-mybatis</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-web</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework</groupId> | |||
|             <artifactId>spring-context-support</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-actuator</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>de.codecentric</groupId> | |||
|             <artifactId>spring-boot-admin-starter-client</artifactId> | |||
|             <version>${spring.boot.admin.version}</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
|         </dependency> | |||
|         <!-- 替换Feign原生httpclient --> | |||
|         <dependency> | |||
|             <groupId>io.github.openfeign</groupId> | |||
|             <artifactId>feign-httpclient</artifactId> | |||
|             <version>10.3.0</version> | |||
|         </dependency> | |||
|     </dependencies> | |||
| 
 | |||
|     <build> | |||
|         <finalName>${project.artifactId}</finalName> | |||
|         <plugins> | |||
|             <plugin> | |||
|                 <groupId>org.springframework.boot</groupId> | |||
|                 <artifactId>spring-boot-maven-plugin</artifactId> | |||
|             </plugin> | |||
|             <plugin> | |||
|                 <groupId>org.apache.maven.plugins</groupId> | |||
|                 <artifactId>maven-surefire-plugin</artifactId> | |||
|                 <configuration> | |||
|                     <skipTests>true</skipTests> | |||
|                 </configuration> | |||
|             </plugin> | |||
|         </plugins> | |||
|         <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> | |||
|         <resources> | |||
|             <resource> | |||
|                 <filtering>true</filtering> | |||
|                 <directory>${basedir}/src/main/resources</directory> | |||
|             </resource> | |||
|         </resources> | |||
|     </build> | |||
| 
 | |||
|     <profiles> | |||
|         <profile> | |||
|             <id>dev-local</id> | |||
|             <activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation> | |||
|             <properties> | |||
|                 <server.port>8101</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_gov_issue?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet_gov_issue_user</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>192.168.1.130</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>false</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>dev</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8101</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_gov_issue_dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>192.168.10.150:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>test</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8101</server.port> | |||
|                 <spring.profiles.active>test</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_gov_issue?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>10.10.10.248</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|     </profiles> | |||
| 
 | |||
| </project> | |||
| @ -0,0 +1,20 @@ | |||
| package com.epmet; | |||
| 
 | |||
| 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.0.0 | |||
|  */ | |||
| @SpringBootApplication | |||
| @EnableDiscoveryClient | |||
| @EnableFeignClients | |||
| public class GovIssueApplication { | |||
| 	public static void main(String[] args) { | |||
| 		SpringApplication.run(GovIssueApplication.class, args); | |||
| 	} | |||
| } | |||
| @ -0,0 +1,26 @@ | |||
| /** | |||
|  * Copyright (c) 2018 人人开源 All rights reserved. | |||
|  * <p> | |||
|  * https://www.renren.io
 | |||
|  * <p> | |||
|  * 版权所有,侵权必究! | |||
|  */ | |||
| 
 | |||
| package com.epmet.config; | |||
| 
 | |||
| import com.epmet.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 "govissue"; | |||
|     } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.epmet.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.dto.form.DemoTestFormDTO; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| /** | |||
|  * @Description 测试 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/7 22:47 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("demo") | |||
| public class GovIssueDemoController { | |||
|     private static final Logger logger = LoggerFactory.getLogger(GovIssueDemoController.class); | |||
| 
 | |||
|     @PostMapping("test") | |||
|     public Result test(@RequestBody DemoTestFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO); | |||
|         logger.info(String.format("请求成功客户id[%s],网格id[%s]",formDTO.getCustomerId(),formDTO.getGridId())); | |||
|         return new Result().ok("gov-issue-server请求成功"); | |||
|     } | |||
| } | |||
| 
 | |||
| @ -0,0 +1,95 @@ | |||
| server: | |||
|   port: @server.port@ | |||
|   servlet: | |||
|     context-path: /gov/issue | |||
| 
 | |||
| spring: | |||
|   main: | |||
|     allow-bean-definition-overriding: true | |||
|   application: | |||
|     name: gov-issue-server | |||
|   #环境 dev|test|prod | |||
|   profiles: | |||
|     active: dev | |||
|   jackson: | |||
|     time-zone: GMT+8 | |||
|     date-format: yyyy-MM-dd HH:mm:ss | |||
|   redis: | |||
|     database: @spring.redis.index@ | |||
|     host: @spring.redis.host@ | |||
|     port: @spring.redis.port@ | |||
|     password: @spring.redis.password@ | |||
|     timeout: 30s | |||
|   datasource: | |||
|     druid: | |||
|       #MySQL | |||
|       driver-class-name: com.mysql.cj.jdbc.Driver | |||
|       url: @spring.datasource.druid.url@ | |||
|       username: @spring.datasource.druid.username@ | |||
|       password: @spring.datasource.druid.password@ | |||
|   cloud: | |||
|     nacos: | |||
|       discovery: | |||
|         server-addr: @nacos.server-addr@ | |||
|         #nacos的命名空间ID,默认是public | |||
|         namespace: @nacos.discovery.namespace@ | |||
|         #不把自己注册到注册中心的地址 | |||
|         register-enabled: @nacos.register-enabled@ | |||
|         ip: @nacos.ip@ | |||
|       config: | |||
|         enabled: @nacos.config-enabled@ | |||
|         server-addr: @nacos.server-addr@ | |||
|         namespace: @nacos.config.namespace@ | |||
|         group: @nacos.config.group@ | |||
|         file-extension: yaml | |||
| management: | |||
|   endpoints: | |||
|     web: | |||
|       exposure: | |||
|         include: "*" | |||
|   endpoint: | |||
|     health: | |||
|       show-details: ALWAYS | |||
| 
 | |||
| mybatis-plus: | |||
|   mapper-locations: classpath:/mapper/**/*.xml | |||
|   #实体扫描,多个package用逗号或者分号分隔 | |||
|   typeAliasesPackage: com.epmet.entity | |||
|   global-config: | |||
|     #数据库相关配置 | |||
|     db-config: | |||
|       #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; | |||
|       id-type: ID_WORKER | |||
|       #字段策略 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' | |||
| 
 | |||
| feign: | |||
|   hystrix: | |||
|     enabled: true | |||
|   client: | |||
|     config: | |||
|       default: | |||
|         loggerLevel: BASIC | |||
|   httpclient: | |||
|     enabled: true | |||
| 
 | |||
| hystrix: | |||
|   command: | |||
|     default: | |||
|       execution: | |||
|         isolation: | |||
|           thread: | |||
|             timeoutInMilliseconds: 60000 #缺省为1000 | |||
| 
 | |||
| ribbon: | |||
|   ReadTimeout: 300000 | |||
|   ConnectTimeout: 300000 | |||
| @ -0,0 +1,159 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <configuration> | |||
|     <include resource="org/springframework/boot/logging/logback/base.xml"/> | |||
| 
 | |||
|     <property name="log.path" value="logs/gov-issue"/> | |||
| 
 | |||
|     <!-- 彩色日志格式 --> | |||
|     <property name="CONSOLE_LOG_PATTERN" | |||
|               value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | |||
| 
 | |||
|     <!--1. 输出到控制台--> | |||
|     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |||
|         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | |||
|         <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |||
|             <level>debug</level> | |||
|         </filter> | |||
|         <encoder> | |||
|             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | |||
|             <!-- 设置字符集 --> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|     </appender> | |||
| 
 | |||
|     <!--2. 输出到文档--> | |||
|     <!-- 2.1 level为 DEBUG 日志,时间滚动输出  --> | |||
|     <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/debug.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 日志归档 --> | |||
|             <fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录debug级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>debug</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.2 level为 INFO 日志,时间滚动输出  --> | |||
|     <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/info.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 每天日志归档路径以及格式 --> | |||
|             <fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录info级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>info</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.3 level为 WARN 日志,时间滚动输出  --> | |||
|     <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/warn.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录warn级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>warn</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.4 level为 ERROR 日志,时间滚动输出  --> | |||
|     <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/error.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录ERROR级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>ERROR</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 开发、测试环境 --> | |||
|     <springProfile name="dev,test"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="DEBUG"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
|     <!-- 生产环境 --> | |||
|     <springProfile name="prod"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="CONSOLE"/> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
| </configuration> | |||
| @ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <parent> | |||
|         <artifactId>epmet-module</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-issue</artifactId> | |||
|     <packaging>pom</packaging> | |||
| 
 | |||
|     <modules> | |||
|         <module>gov-issue-client</module> | |||
|         <module>gov-issue-server</module> | |||
|     </modules> | |||
| 
 | |||
| 
 | |||
| </project> | |||
| @ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <parent> | |||
|         <artifactId>gov-project</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-project-client</artifactId> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-tools</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|     </dependencies> | |||
| </project> | |||
| @ -0,0 +1,21 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Description 测试入参 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/8 10:00 | |||
|  */ | |||
| @Data | |||
| public class DemoTestFormDTO implements Serializable { | |||
|     private static final long serialVersionUID = 4859779755214502427L; | |||
|     @NotBlank(message = "客户id不能为空") | |||
|     private String customerId; | |||
|     @NotBlank(message = "网格id不能为空") | |||
|     private String gridId; | |||
| } | |||
| 
 | |||
| @ -0,0 +1,11 @@ | |||
| FROM java:8 | |||
| 
 | |||
| RUN export LANG="zh_CN.UTF-8" | |||
| RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
| RUN echo 'Asia/Shanghai' > /etc/timezone | |||
| 
 | |||
| COPY ./target/*.jar ./app.jar | |||
| 
 | |||
| EXPOSE 8102 | |||
| 
 | |||
| ENTRYPOINT ["java","-Xms32m","-Xmx200m","-jar","./app.jar"] | |||
| @ -0,0 +1,15 @@ | |||
| version: "3.7" | |||
| services: | |||
|   gov-project-server: | |||
|     container_name: gov-project-server-dev | |||
|     image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-project-server:0.3.0 | |||
|     ports: | |||
|       - "8102:8102" | |||
|     network_mode: host # 使用现有网络 | |||
|     volumes: | |||
|       - "/opt/epmet-cloud-logs/dev:/logs" | |||
|     deploy: | |||
|       resources: | |||
|         limits: | |||
|           cpus: '0.1' | |||
|           memory: 250M | |||
| @ -0,0 +1,182 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <version>0.3.0</version> | |||
|     <parent> | |||
|         <artifactId>gov-project</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-project-server</artifactId> | |||
|     <packaging>jar</packaging> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>gov-project-client</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-tools</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-mybatis</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-web</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework</groupId> | |||
|             <artifactId>spring-context-support</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-actuator</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>de.codecentric</groupId> | |||
|             <artifactId>spring-boot-admin-starter-client</artifactId> | |||
|             <version>${spring.boot.admin.version}</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
|         </dependency> | |||
|         <!-- 替换Feign原生httpclient --> | |||
|         <dependency> | |||
|             <groupId>io.github.openfeign</groupId> | |||
|             <artifactId>feign-httpclient</artifactId> | |||
|             <version>10.3.0</version> | |||
|         </dependency> | |||
|     </dependencies> | |||
| 
 | |||
|     <build> | |||
|         <finalName>${project.artifactId}</finalName> | |||
|         <plugins> | |||
|             <plugin> | |||
|                 <groupId>org.springframework.boot</groupId> | |||
|                 <artifactId>spring-boot-maven-plugin</artifactId> | |||
|             </plugin> | |||
|             <plugin> | |||
|                 <groupId>org.apache.maven.plugins</groupId> | |||
|                 <artifactId>maven-surefire-plugin</artifactId> | |||
|                 <configuration> | |||
|                     <skipTests>true</skipTests> | |||
|                 </configuration> | |||
|             </plugin> | |||
|         </plugins> | |||
|         <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> | |||
|         <resources> | |||
|             <resource> | |||
|                 <filtering>true</filtering> | |||
|                 <directory>${basedir}/src/main/resources</directory> | |||
|             </resource> | |||
|         </resources> | |||
|     </build> | |||
| 
 | |||
|     <profiles> | |||
|         <profile> | |||
|             <id>dev-local</id> | |||
|             <activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation> | |||
|             <properties> | |||
|                 <server.port>8102</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_gov_project?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet_gov_project_user</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>192.168.1.130</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>false</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>dev</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8102</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_gov_project_dev?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>192.168.10.150:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>test</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8102</server.port> | |||
|                 <spring.profiles.active>test</spring.profiles.active> | |||
| 
 | |||
|                 <!-- 数据库配置--> | |||
|                 <spring.datasource.druid.url> | |||
|                     <![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_gov_project?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> | |||
|                 </spring.datasource.druid.url> | |||
|                 <spring.datasource.druid.username>epmet</spring.datasource.druid.username> | |||
|                 <spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>10.10.10.248</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|     </profiles> | |||
| 
 | |||
| </project> | |||
| @ -0,0 +1,20 @@ | |||
| package com.epmet; | |||
| 
 | |||
| 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.0.0 | |||
|  */ | |||
| @SpringBootApplication | |||
| @EnableDiscoveryClient | |||
| @EnableFeignClients | |||
| public class GovProjectApplication { | |||
| 	public static void main(String[] args) { | |||
| 		SpringApplication.run(GovProjectApplication.class, args); | |||
| 	} | |||
| } | |||
| @ -0,0 +1,26 @@ | |||
| /** | |||
|  * Copyright (c) 2018 人人开源 All rights reserved. | |||
|  * <p> | |||
|  * https://www.renren.io
 | |||
|  * <p> | |||
|  * 版权所有,侵权必究! | |||
|  */ | |||
| 
 | |||
| package com.epmet.config; | |||
| 
 | |||
| import com.epmet.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 "govissue"; | |||
|     } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.epmet.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.dto.form.DemoTestFormDTO; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| /** | |||
|  * @Description 测试 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/7 22:47 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("demo") | |||
| public class GovProjectDemoController { | |||
|     private static final Logger logger = LoggerFactory.getLogger(GovProjectDemoController.class); | |||
| 
 | |||
|     @PostMapping("test") | |||
|     public Result test(@RequestBody DemoTestFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO); | |||
|         logger.info(String.format("请求成功客户id[%s],网格id[%s]",formDTO.getCustomerId(),formDTO.getGridId())); | |||
|         return new Result().ok("gov-project-server请求成功"); | |||
|     } | |||
| } | |||
| 
 | |||
| @ -0,0 +1,95 @@ | |||
| server: | |||
|   port: @server.port@ | |||
|   servlet: | |||
|     context-path: /gov/project | |||
| 
 | |||
| spring: | |||
|   main: | |||
|     allow-bean-definition-overriding: true | |||
|   application: | |||
|     name: gov-project-server | |||
|   #环境 dev|test|prod | |||
|   profiles: | |||
|     active: dev | |||
|   jackson: | |||
|     time-zone: GMT+8 | |||
|     date-format: yyyy-MM-dd HH:mm:ss | |||
|   redis: | |||
|     database: @spring.redis.index@ | |||
|     host: @spring.redis.host@ | |||
|     port: @spring.redis.port@ | |||
|     password: @spring.redis.password@ | |||
|     timeout: 30s | |||
|   datasource: | |||
|     druid: | |||
|       #MySQL | |||
|       driver-class-name: com.mysql.cj.jdbc.Driver | |||
|       url: @spring.datasource.druid.url@ | |||
|       username: @spring.datasource.druid.username@ | |||
|       password: @spring.datasource.druid.password@ | |||
|   cloud: | |||
|     nacos: | |||
|       discovery: | |||
|         server-addr: @nacos.server-addr@ | |||
|         #nacos的命名空间ID,默认是public | |||
|         namespace: @nacos.discovery.namespace@ | |||
|         #不把自己注册到注册中心的地址 | |||
|         register-enabled: @nacos.register-enabled@ | |||
|         ip: @nacos.ip@ | |||
|       config: | |||
|         enabled: @nacos.config-enabled@ | |||
|         server-addr: @nacos.server-addr@ | |||
|         namespace: @nacos.config.namespace@ | |||
|         group: @nacos.config.group@ | |||
|         file-extension: yaml | |||
| management: | |||
|   endpoints: | |||
|     web: | |||
|       exposure: | |||
|         include: "*" | |||
|   endpoint: | |||
|     health: | |||
|       show-details: ALWAYS | |||
| 
 | |||
| mybatis-plus: | |||
|   mapper-locations: classpath:/mapper/**/*.xml | |||
|   #实体扫描,多个package用逗号或者分号分隔 | |||
|   typeAliasesPackage: com.epmet.entity | |||
|   global-config: | |||
|     #数据库相关配置 | |||
|     db-config: | |||
|       #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; | |||
|       id-type: ID_WORKER | |||
|       #字段策略 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' | |||
| 
 | |||
| feign: | |||
|   hystrix: | |||
|     enabled: true | |||
|   client: | |||
|     config: | |||
|       default: | |||
|         loggerLevel: BASIC | |||
|   httpclient: | |||
|     enabled: true | |||
| 
 | |||
| hystrix: | |||
|   command: | |||
|     default: | |||
|       execution: | |||
|         isolation: | |||
|           thread: | |||
|             timeoutInMilliseconds: 60000 #缺省为1000 | |||
| 
 | |||
| ribbon: | |||
|   ReadTimeout: 300000 | |||
|   ConnectTimeout: 300000 | |||
| @ -0,0 +1,159 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <configuration> | |||
|     <include resource="org/springframework/boot/logging/logback/base.xml"/> | |||
| 
 | |||
|     <property name="log.path" value="logs/gov-project"/> | |||
| 
 | |||
|     <!-- 彩色日志格式 --> | |||
|     <property name="CONSOLE_LOG_PATTERN" | |||
|               value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | |||
| 
 | |||
|     <!--1. 输出到控制台--> | |||
|     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |||
|         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | |||
|         <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |||
|             <level>debug</level> | |||
|         </filter> | |||
|         <encoder> | |||
|             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | |||
|             <!-- 设置字符集 --> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|     </appender> | |||
| 
 | |||
|     <!--2. 输出到文档--> | |||
|     <!-- 2.1 level为 DEBUG 日志,时间滚动输出  --> | |||
|     <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/debug.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 日志归档 --> | |||
|             <fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录debug级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>debug</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.2 level为 INFO 日志,时间滚动输出  --> | |||
|     <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/info.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 每天日志归档路径以及格式 --> | |||
|             <fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录info级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>info</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.3 level为 WARN 日志,时间滚动输出  --> | |||
|     <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/warn.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录warn级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>warn</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.4 level为 ERROR 日志,时间滚动输出  --> | |||
|     <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/error.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录ERROR级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>ERROR</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 开发、测试环境 --> | |||
|     <springProfile name="dev,test"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="DEBUG"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
|     <!-- 生产环境 --> | |||
|     <springProfile name="prod"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="CONSOLE"/> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
| </configuration> | |||
| @ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <parent> | |||
|         <artifactId>epmet-module</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <artifactId>gov-project</artifactId> | |||
|     <packaging>pom</packaging> | |||
| 
 | |||
|     <modules> | |||
|         <module>gov-project-client</module> | |||
|         <module>gov-project-server</module> | |||
|     </modules> | |||
| 
 | |||
| 
 | |||
| </project> | |||
| @ -0,0 +1,21 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
| 
 | |||
|     <parent> | |||
|         <artifactId>epmet-module</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
| 
 | |||
|     <groupId>com.epmet</groupId> | |||
|     <artifactId>resi-hall</artifactId> | |||
|     <packaging>pom</packaging> | |||
| 
 | |||
|     <modules> | |||
|         <module>resi-hall-client</module> | |||
|         <module>resi-hall-server</module> | |||
|     </modules> | |||
| </project> | |||
| @ -0,0 +1,34 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
|     <parent> | |||
|         <artifactId>resi-hall</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
| 
 | |||
|     <artifactId>resi-hall-client</artifactId> | |||
|     <packaging>jar</packaging> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>epmet-commons-tools</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>io.springfox</groupId> | |||
|             <artifactId>springfox-swagger2</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>io.springfox</groupId> | |||
|             <artifactId>springfox-swagger-ui</artifactId> | |||
|         </dependency> | |||
|     </dependencies> | |||
| 
 | |||
|     <build> | |||
|         <finalName>${project.artifactId}</finalName> | |||
|     </build> | |||
| </project> | |||
| @ -0,0 +1,21 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * @Description 测试入参 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/8 10:00 | |||
|  */ | |||
| @Data | |||
| public class DemoTestFormDTO implements Serializable { | |||
|     private static final long serialVersionUID = 4859779755214502427L; | |||
|     @NotBlank(message = "客户id不能为空") | |||
|     private String customerId; | |||
|     @NotBlank(message = "网格id不能为空") | |||
|     private String gridId; | |||
| } | |||
| 
 | |||
| @ -0,0 +1,11 @@ | |||
| FROM java:8 | |||
| 
 | |||
| RUN export LANG="zh_CN.UTF-8" | |||
| RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
| RUN echo 'Asia/Shanghai' > /etc/timezone | |||
| 
 | |||
| COPY ./target/*.jar ./app.jar | |||
| 
 | |||
| EXPOSE 8100 | |||
| 
 | |||
| ENTRYPOINT ["java","-Xms32m","-Xmx250m","-jar","./app.jar"] | |||
| @ -0,0 +1,15 @@ | |||
| version: "3.7" | |||
| services: | |||
|   resi-hall-server: | |||
|     container_name: resi-hall-server-dev | |||
|     image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/resi-hall-server:0.3.0 | |||
|     ports: | |||
|       - "8100:8100" | |||
|     network_mode: host # 使用现有网络 | |||
|     volumes: | |||
|       - "/opt/epmet-cloud-logs/dev:/logs" | |||
|     deploy: | |||
|       resources: | |||
|         limits: | |||
|           cpus: '0.1' | |||
|           memory: 300M | |||
| @ -0,0 +1,147 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |||
|          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
|          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
|     <modelVersion>4.0.0</modelVersion> | |||
|     <version>0.3.0</version> | |||
|     <parent> | |||
|         <artifactId>resi-hall</artifactId> | |||
|         <groupId>com.epmet</groupId> | |||
|         <version>2.0.0</version> | |||
|     </parent> | |||
| 
 | |||
|     <artifactId>resi-hall-server</artifactId> | |||
|     <packaging>jar</packaging> | |||
| 
 | |||
|     <dependencies> | |||
|         <dependency> | |||
|             <groupId>com.epmet</groupId> | |||
|             <artifactId>resi-hall-client</artifactId> | |||
|             <version>2.0.0</version> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-web</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework</groupId> | |||
|             <artifactId>spring-context-support</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>org.springframework.boot</groupId> | |||
|             <artifactId>spring-boot-starter-actuator</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
|         </dependency> | |||
|         <dependency> | |||
|             <groupId>com.alibaba.cloud</groupId> | |||
|             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
|         </dependency> | |||
|         <!-- 替换Feign原生httpclient --> | |||
|         <dependency> | |||
|             <groupId>io.github.openfeign</groupId> | |||
|             <artifactId>feign-httpclient</artifactId> | |||
|             <version>10.3.0</version> | |||
|         </dependency> | |||
|     </dependencies> | |||
| 
 | |||
|     <build> | |||
|         <finalName>${project.artifactId}</finalName> | |||
|         <plugins> | |||
|             <plugin> | |||
|                 <groupId>org.springframework.boot</groupId> | |||
|                 <artifactId>spring-boot-maven-plugin</artifactId> | |||
|             </plugin> | |||
|             <plugin> | |||
|                 <groupId>org.apache.maven.plugins</groupId> | |||
|                 <artifactId>maven-surefire-plugin</artifactId> | |||
|                 <configuration> | |||
|                     <skipTests>true</skipTests> | |||
|                 </configuration> | |||
|             </plugin> | |||
|         </plugins> | |||
|         <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> | |||
|         <resources> | |||
|             <resource> | |||
|                 <filtering>true</filtering> | |||
|                 <directory>${basedir}/src/main/resources</directory> | |||
|             </resource> | |||
|         </resources> | |||
|     </build> | |||
|     <profiles> | |||
|         <profile> | |||
|             <id>dev-local</id> | |||
|             <activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation> | |||
|             <properties> | |||
|                 <server.port>8100</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>192.168.1.130</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>false</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>dev</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8100</server.port> | |||
|                 <spring.profiles.active>dev</spring.profiles.active> | |||
| 
 | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>192.168.10.150:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|         <profile> | |||
|             <id>test</id> | |||
|             <!--<activation> | |||
|                 <activeByDefault>true</activeByDefault> | |||
|             </activation>--> | |||
|             <properties> | |||
|                 <server.port>8100</server.port> | |||
|                 <spring.profiles.active>test</spring.profiles.active> | |||
| 
 | |||
|                 <!-- redis配置 --> | |||
|                 <spring.redis.index>0</spring.redis.index> | |||
|                 <spring.redis.host>10.10.10.248</spring.redis.host> | |||
|                 <spring.redis.port>6379</spring.redis.port> | |||
|                 <spring.redis.password>123456</spring.redis.password> | |||
|                 <!-- nacos --> | |||
|                 <nacos.register-enabled>true</nacos.register-enabled> | |||
|                 <nacos.server-addr>122.152.200.70:8848</nacos.server-addr> | |||
|                 <nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> | |||
|                 <nacos.config.namespace></nacos.config.namespace> | |||
|                 <nacos.config.group></nacos.config.group> | |||
|                 <nacos.config-enabled>false</nacos.config-enabled> | |||
|                 <nacos.ip/> | |||
|             </properties> | |||
|         </profile> | |||
|     </profiles> | |||
| </project> | |||
| @ -0,0 +1,23 @@ | |||
| package com.epmet; | |||
| 
 | |||
| 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.0.0 | |||
|  */ | |||
| @SpringBootApplication | |||
| @EnableDiscoveryClient | |||
| @EnableFeignClients | |||
| public class ResiHallApplication { | |||
| 
 | |||
|     public static void main(String[] args) { | |||
|         SpringApplication.run(ResiHallApplication.class, args); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,26 @@ | |||
| /** | |||
|  * Copyright (c) 2018 人人开源 All rights reserved. | |||
|  * | |||
|  * https://www.renren.io
 | |||
|  * | |||
|  * 版权所有,侵权必究! | |||
|  */ | |||
| 
 | |||
| package com.epmet.config; | |||
| 
 | |||
| import com.epmet.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 "resihall"; | |||
|     } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.epmet.controller; | |||
| 
 | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.dto.form.DemoTestFormDTO; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.web.bind.annotation.*; | |||
| 
 | |||
| /** | |||
|  * @Description 测试 | |||
|  * @Author yinzuomei | |||
|  * @Date 2020/5/7 22:47 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("demo") | |||
| public class ResiHallDemoController { | |||
|     private static final Logger logger = LoggerFactory.getLogger(ResiHallDemoController.class); | |||
| 
 | |||
|     @PostMapping("test") | |||
|     public Result test(@RequestBody DemoTestFormDTO formDTO) { | |||
|         logger.info(String.format("请求成功客户id[%s],网格id[%s]",formDTO.getCustomerId(),formDTO.getGridId())); | |||
|         ValidatorUtils.validateEntity(formDTO); | |||
|         return new Result().ok("resi-hall-server请求成功"); | |||
|     } | |||
| } | |||
| 
 | |||
| @ -0,0 +1,16 @@ | |||
| package com.epmet.exception; | |||
| 
 | |||
| import com.epmet.commons.tools.exception.ErrorCode; | |||
| 
 | |||
| /** | |||
|  * 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 | |||
|  * <p> | |||
|  * 如:100001001(100001代表模块,001代表业务代码) | |||
|  * </p> | |||
|  * | |||
|  * @author Mark sunlightcs@gmail.com | |||
|  * @since 1.0.0 | |||
|  */ | |||
| public interface ModuleErrorCode extends ErrorCode { | |||
| 
 | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| package com.epmet.util; | |||
| 
 | |||
| 
 | |||
| public interface ModuleConstant { | |||
| } | |||
| @ -0,0 +1,71 @@ | |||
| server: | |||
|   port: @server.port@ | |||
|   servlet: | |||
|     context-path: /resi/hall | |||
| 
 | |||
| spring: | |||
|   main: | |||
|     allow-bean-definition-overriding: true | |||
|   application: | |||
|     name: resi-hall-server | |||
|   #环境 dev|test|prod | |||
|   profiles: | |||
|     active: dev | |||
|   messages: | |||
|     encoding: UTF-8 | |||
|     basename: 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@ | |||
|     port: @spring.redis.port@ | |||
|     password: @spring.redis.password@ | |||
|     timeout: 30s | |||
|   cloud: | |||
|     nacos: | |||
|       discovery: | |||
|         server-addr: @nacos.server-addr@ | |||
|         #nacos的命名空间ID,默认是public | |||
|         namespace: @nacos.discovery.namespace@ | |||
|         #不把自己注册到注册中心的地址 | |||
|         register-enabled: @nacos.register-enabled@ | |||
|         ip: @nacos.ip@ | |||
|       config: | |||
|         enabled: @nacos.config-enabled@ | |||
|         server-addr: @nacos.server-addr@ | |||
|         namespace: @nacos.config.namespace@ | |||
|         group: @nacos.config.group@ | |||
|         file-extension: yaml | |||
| management: | |||
|   endpoints: | |||
|     web: | |||
|       exposure: | |||
|         include: "*" | |||
|   endpoint: | |||
|     health: | |||
|       show-details: ALWAYS | |||
| 
 | |||
| 
 | |||
| feign: | |||
|   hystrix: | |||
|     enabled: true | |||
|   client: | |||
|     config: | |||
|       default: | |||
|         loggerLevel: BASIC | |||
|   httpclient: | |||
|     enabled: true | |||
| 
 | |||
| hystrix: | |||
|   command: | |||
|     default: | |||
|       execution: | |||
|         isolation: | |||
|           thread: | |||
|             timeoutInMilliseconds: 60000 #缺省为1000 | |||
| 
 | |||
| ribbon: | |||
|   ReadTimeout: 300000 | |||
|   ConnectTimeout: 300000 | |||
| @ -0,0 +1,159 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <configuration> | |||
|     <include resource="org/springframework/boot/logging/logback/base.xml"/> | |||
| 
 | |||
|     <property name="log.path" value="logs/resi-hall"/> | |||
| 
 | |||
|     <!-- 彩色日志格式 --> | |||
|     <property name="CONSOLE_LOG_PATTERN" | |||
|               value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | |||
| 
 | |||
|     <!--1. 输出到控制台--> | |||
|     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |||
|         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | |||
|         <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |||
|             <level>debug</level> | |||
|         </filter> | |||
|         <encoder> | |||
|             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | |||
|             <!-- 设置字符集 --> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|     </appender> | |||
| 
 | |||
|     <!--2. 输出到文档--> | |||
|     <!-- 2.1 level为 DEBUG 日志,时间滚动输出  --> | |||
|     <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/debug.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 日志归档 --> | |||
|             <fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录debug级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>debug</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.2 level为 INFO 日志,时间滚动输出  --> | |||
|     <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/info.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <!-- 每天日志归档路径以及格式 --> | |||
|             <fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录info级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>info</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.3 level为 WARN 日志,时间滚动输出  --> | |||
|     <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/warn.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录warn级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>warn</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 2.4 level为 ERROR 日志,时间滚动输出  --> | |||
|     <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
|         <!-- 正在记录的日志文档的路径及文档名 --> | |||
|         <file>${log.path}/error.log</file> | |||
|         <!--日志文档输出格式--> | |||
|         <encoder> | |||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | |||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | |||
|         </encoder> | |||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | |||
|         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |||
|             <fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |||
|             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |||
|                 <maxFileSize>100MB</maxFileSize> | |||
|             </timeBasedFileNamingAndTriggeringPolicy> | |||
|             <!--日志文档保留天数--> | |||
|             <maxHistory>15</maxHistory> | |||
|         </rollingPolicy> | |||
|         <!-- 此日志文档只记录ERROR级别的 --> | |||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | |||
|             <level>ERROR</level> | |||
|             <onMatch>ACCEPT</onMatch> | |||
|             <onMismatch>DENY</onMismatch> | |||
|         </filter> | |||
|     </appender> | |||
| 
 | |||
|     <!-- 开发、测试环境 --> | |||
|     <springProfile name="dev,test"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="DEBUG"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
|     <!-- 生产环境 --> | |||
|     <springProfile name="prod"> | |||
|         <logger name="org.springframework.web" level="INFO"/> | |||
|         <logger name="org.springboot.sample" level="INFO"/> | |||
|         <logger name="com.epmet.dao" level="INFO"/> | |||
|         <root level="INFO"> | |||
|             <appender-ref ref="CONSOLE"/> | |||
|             <appender-ref ref="DEBUG_FILE"/> | |||
|             <appender-ref ref="INFO_FILE"/> | |||
|             <appender-ref ref="WARN_FILE"/> | |||
|             <appender-ref ref="ERROR_FILE"/> | |||
|         </root> | |||
|     </springProfile> | |||
| 
 | |||
| </configuration> | |||
					Loading…
					
					
				
		Reference in new issue