25 changed files with 1062 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||
|
# 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/ |
@ -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 -Xmx1024m $JAR_PATH |
||||
|
EXPOSE ${SERVER_PORT} |
@ -0,0 +1,254 @@ |
|||||
|
<?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> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-cloud-parent-yushan</artifactId> |
||||
|
<version>1.0.0</version> |
||||
|
<relativePath>../epdc-cloud-parent-yushan</relativePath> |
||||
|
</parent> |
||||
|
|
||||
|
<artifactId>epdc-cloud-websocket</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
<description>榆山党群e事通websocket</description> |
||||
|
|
||||
|
<dependencies> |
||||
|
<!-- websocket --> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-websocket</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.core</groupId> |
||||
|
<artifactId>jackson-databind</artifactId> |
||||
|
<version>2.10.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> |
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.core</groupId> |
||||
|
<artifactId>jackson-core</artifactId> |
||||
|
<version>2.10.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --> |
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.core</groupId> |
||||
|
<artifactId>jackson-annotations</artifactId> |
||||
|
<version>2.10.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- nacos start --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
|
</dependency> |
||||
|
<!-- nacos end --> |
||||
|
|
||||
|
<!-- 替换Feign原生httpclient --> |
||||
|
<dependency> |
||||
|
<groupId>io.github.openfeign</groupId> |
||||
|
<artifactId>feign-httpclient</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>io.jsonwebtoken</groupId> |
||||
|
<artifactId>jjwt</artifactId> |
||||
|
<version>0.7.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- client start --> |
||||
|
<dependency> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-cloud-websocket-client</artifactId> |
||||
|
<version>${epdc-cloud-client.version}</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-cloud-user-client</artifactId> |
||||
|
<version>${epdc-cloud-client.version}</version> |
||||
|
</dependency> |
||||
|
<!-- client end --> |
||||
|
|
||||
|
<!-- commons start --> |
||||
|
<dependency> |
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-commons-tools</artifactId> |
||||
|
<version>${epdc-cloud-commons.version}</version> |
||||
|
</dependency> |
||||
|
<!-- commons end --> |
||||
|
</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> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-deploy-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<skip>true</skip> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>com.spotify</groupId> |
||||
|
<artifactId>dockerfile-maven-plugin</artifactId> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
|
||||
|
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
||||
|
|
||||
|
<resources> |
||||
|
<resource> |
||||
|
<filtering>true</filtering> |
||||
|
<directory>${basedir}/src/main/resources</directory> |
||||
|
<includes> |
||||
|
<include>**/application*.yml</include> |
||||
|
<include>**/*.properties</include> |
||||
|
<include>logback-spring.xml</include> |
||||
|
<include>registry.conf</include> |
||||
|
</includes> |
||||
|
</resource> |
||||
|
<resource> |
||||
|
<directory>${basedir}/src/main/resources</directory> |
||||
|
<excludes> |
||||
|
<exclude>**/application*.yml</exclude> |
||||
|
<exclude>**/*.properties</exclude> |
||||
|
<exclude>logback-spring.xml</exclude> |
||||
|
<exclude>registry.conf</exclude> |
||||
|
</excludes> |
||||
|
</resource> |
||||
|
</resources> |
||||
|
</build> |
||||
|
|
||||
|
<profiles> |
||||
|
<profile> |
||||
|
<id>dev</id> |
||||
|
<activation> |
||||
|
<activeByDefault>true</activeByDefault> |
||||
|
</activation> |
||||
|
<properties> |
||||
|
<spring.profiles.active>dev</spring.profiles.active> |
||||
|
<docker.tag>dev</docker.tag> |
||||
|
|
||||
|
<server.port>9988</server.port> |
||||
|
|
||||
|
<spring.redis.index>2</spring.redis.index> |
||||
|
<spring.redis.host>47.104.224.45</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>elink@888</spring.redis.password> |
||||
|
|
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_api?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password> |
||||
|
|
||||
|
<nacos.register-enabled>false</nacos.register-enabled> |
||||
|
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> |
||||
|
<nacos.ip></nacos.ip> |
||||
|
<nacos.namespace>6a3577b4-7b79-43f6-aebb-9c3f31263f6a</nacos.namespace> |
||||
|
|
||||
|
<!--公众号配置--> |
||||
|
<wx.mp.configs.appId>wx3ef8f2cd12a19fcb</wx.mp.configs.appId> |
||||
|
<wx.mp.configs.secret>948aa2f21dbaa3943288ea5b119ac6f2</wx.mp.configs.secret> |
||||
|
<wx.mp.configs.token>111</wx.mp.configs.token> |
||||
|
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> |
||||
|
<!--小程序配置--> |
||||
|
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId> |
||||
|
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
|
||||
|
<profile> |
||||
|
<id>test</id> |
||||
|
<properties> |
||||
|
<spring.profiles.active>test</spring.profiles.active> |
||||
|
<docker.tag>test</docker.tag> |
||||
|
|
||||
|
<server.port>10016</server.port> |
||||
|
|
||||
|
<spring.redis.index>2</spring.redis.index> |
||||
|
<spring.redis.host>114.215.125.123</spring.redis.host> |
||||
|
<spring.redis.port>9603</spring.redis.port> |
||||
|
<spring.redis.password>epdc!redis@master1405</spring.redis.password> |
||||
|
|
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://47.104.224.45:3308/esua_epdc_api?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>elink833066</spring.datasource.druid.password> |
||||
|
|
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr> |
||||
|
<nacos.ip>47.104.85.99</nacos.ip> |
||||
|
<nacos.namespace>6a3577b4-7b79-43f6-aebb-9c3f31263f6a</nacos.namespace> |
||||
|
|
||||
|
<!--公众号配置--> |
||||
|
<wx.mp.configs.appId>wx3ef8f2cd12a19fcb</wx.mp.configs.appId> |
||||
|
<wx.mp.configs.secret>948aa2f21dbaa3943288ea5b119ac6f2</wx.mp.configs.secret> |
||||
|
<wx.mp.configs.token>111</wx.mp.configs.token> |
||||
|
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> |
||||
|
<!--小程序配置--> |
||||
|
<!-- <wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId>--> |
||||
|
<!-- <wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret>--> |
||||
|
|
||||
|
<wx.ma.appId>wx5d3e97461d248397</wx.ma.appId> |
||||
|
<wx.ma.secret>bfed51b731e53db9affb9e6131e7ae12</wx.ma.secret> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
|
||||
|
<profile> |
||||
|
<id>prod</id> |
||||
|
<properties> |
||||
|
<spring.profiles.active>prod</spring.profiles.active> |
||||
|
<docker.tag>prod</docker.tag> |
||||
|
|
||||
|
<server.port>9988</server.port> |
||||
|
|
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>172.16.0.54</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>Elink833066</spring.redis.password> |
||||
|
|
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://172.16.0.52:3306/esua_epdc_api?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epdc</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>Elink@833066</spring.datasource.druid.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>172.16.0.52:8848</nacos.server-addr> |
||||
|
<nacos.ip></nacos.ip> |
||||
|
<nacos.namespace></nacos.namespace> |
||||
|
<!--公众号配置--> |
||||
|
<wx.mp.configs.appId>wx3ef8f2cd12a19fcb</wx.mp.configs.appId> |
||||
|
<wx.mp.configs.secret>948aa2f21dbaa3943288ea5b119ac6f2</wx.mp.configs.secret> |
||||
|
<wx.mp.configs.token>111</wx.mp.configs.token> |
||||
|
<wx.mp.configs.aesKey>111</wx.mp.configs.aesKey> |
||||
|
<!--党群e家小程序配置--> |
||||
|
<wx.ma.appId>wxdd8530c5f4926766</wx.ma.appId> |
||||
|
<wx.ma.secret>5bf4fb813145431b3493a10aa7e041e9</wx.ma.secret> |
||||
|
<!--先锋市北小程序配置--> |
||||
|
<!-- <wx.ma.appId>wx5d3e97461d248397</wx.ma.appId>--> |
||||
|
<!-- <wx.ma.secret>bfed51b731e53db9affb9e6131e7ae12</wx.ma.secret>--> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
</profiles> |
||||
|
|
||||
|
</project> |
@ -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.0.0 |
||||
|
*/ |
||||
|
@SpringBootApplication |
||||
|
@EnableDiscoveryClient |
||||
|
@EnableFeignClients |
||||
|
public class ModuleApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(ModuleApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
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 "epdc-websocket-server"; |
||||
|
} |
||||
|
} |
@ -0,0 +1,126 @@ |
|||||
|
package com.elink.esua.epdc.config; |
||||
|
|
||||
|
import com.elink.esua.epdc.constants.WebSocketConstant; |
||||
|
import com.elink.esua.epdc.jwt.JwtTokenUtils; |
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.messaging.Message; |
||||
|
import org.springframework.messaging.MessageChannel; |
||||
|
import org.springframework.messaging.converter.MessageConverter; |
||||
|
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver; |
||||
|
import org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler; |
||||
|
import org.springframework.messaging.simp.config.ChannelRegistration; |
||||
|
import org.springframework.messaging.simp.config.MessageBrokerRegistry; |
||||
|
import org.springframework.messaging.simp.stomp.StompCommand; |
||||
|
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; |
||||
|
import org.springframework.messaging.support.ChannelInterceptor; |
||||
|
import org.springframework.messaging.support.MessageHeaderAccessor; |
||||
|
import org.springframework.web.socket.config.annotation.*; |
||||
|
|
||||
|
import java.security.Principal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 启用STOMP协议来传输基于代理(message broker)的消息 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 19-10-25 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@EnableWebSocketMessageBroker |
||||
|
public class WebSocketConfig extends WebSocketMessageBrokerConfigurationSupport implements WebSocketMessageBrokerConfigurer { |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenUtils jwtUtil; |
||||
|
|
||||
|
@Override |
||||
|
public void configureWebSocketTransport(WebSocketTransportRegistration registry) { |
||||
|
super.configureWebSocketTransport(registry); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean configureMessageConverters(List<MessageConverter> messageConverters) { |
||||
|
return super.configureMessageConverters(messageConverters); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void configureClientInboundChannel(ChannelRegistration registration) { |
||||
|
registration.interceptors(new ChannelInterceptor() { |
||||
|
|
||||
|
@Override |
||||
|
public Message<?> preSend(Message<?> message, MessageChannel channel) { |
||||
|
|
||||
|
StompHeaderAccessor accessor = |
||||
|
MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class); |
||||
|
|
||||
|
if (StompCommand.CONNECT.equals(accessor.getCommand())) { |
||||
|
String jwtToken = accessor.getFirstNativeHeader("token"); |
||||
|
if (StringUtils.isNotEmpty(jwtToken)) { |
||||
|
Claims claims = jwtUtil.getClaimByToken(jwtToken); |
||||
|
String userId = claims.getSubject(); |
||||
|
accessor.setUser(new FastPrincipal(userId)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return message; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void configureClientOutboundChannel(ChannelRegistration registration) { |
||||
|
super.configureClientOutboundChannel(registration); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { |
||||
|
super.addArgumentResolvers(argumentResolvers); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) { |
||||
|
super.addReturnValueHandlers(returnValueHandlers); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void registerStompEndpoints(StompEndpointRegistry registry) { |
||||
|
registry.addEndpoint(WebSocketConstant.MENU_NOTICE_ENDPOINT) |
||||
|
// 添加允许跨域访问
|
||||
|
.setAllowedOrigins("*") |
||||
|
.withSockJS(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void configureMessageBroker(MessageBrokerRegistry registry) { |
||||
|
//客户端发送消息的请求前缀
|
||||
|
registry.setApplicationDestinationPrefixes(WebSocketConstant.APPLICATION_DESTINATION_PREFIXES); |
||||
|
//客户端订阅消息的请求前缀,topic一般用于广播推送,queue用于点对点推送
|
||||
|
registry.enableSimpleBroker(WebSocketConstant.MENU_NOTICE_TOPIC, WebSocketConstant.MENU_NOTICE_QUEUE); |
||||
|
//服务端通知客户端的前缀,可以不设置,默认为user
|
||||
|
registry.setUserDestinationPrefix(WebSocketConstant.USER_DESTINATION_PREFIX); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 定义一个自己的权限验证类 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 19-10-27 |
||||
|
*/ |
||||
|
class FastPrincipal implements Principal { |
||||
|
|
||||
|
private final String name; |
||||
|
|
||||
|
public FastPrincipal(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.elink.esua.epdc.constants; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Description: websocket常量类 |
||||
|
* @date 18-9-14 |
||||
|
*/ |
||||
|
public class WebSocketConstant { |
||||
|
|
||||
|
public final static String MENU_NOTICE_ENDPOINT = "/menuNoticeEndpoint"; |
||||
|
|
||||
|
public final static String APPLICATION_DESTINATION_PREFIXES = "/notice"; |
||||
|
|
||||
|
public final static String MENU_NOTICE_TOPIC = "/menuNoticeTopic"; |
||||
|
|
||||
|
public final static String MENU_NOTICE_QUEUE = "/menuNoticeQueue"; |
||||
|
|
||||
|
public final static String USER_DESTINATION_PREFIX = "/userMenuNotice/"; |
||||
|
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.constants.WebSocketConstant; |
||||
|
import com.elink.esua.epdc.dto.EventMenuNoticeDto; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.messaging.simp.SimpMessageSendingOperations; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Date 19-10-28 |
||||
|
*/ |
||||
|
@RestController |
||||
|
public class Demo2Controller { |
||||
|
|
||||
|
@Autowired |
||||
|
private SimpMessageSendingOperations template; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param message |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@GetMapping("/sendHello2") |
||||
|
public String say2(@RequestBody EventMenuNoticeDto message) { |
||||
|
template.convertAndSendToUser( |
||||
|
"1067246875800000001", |
||||
|
WebSocketConstant.MENU_NOTICE_QUEUE.concat("/menu/getResponse"), |
||||
|
message |
||||
|
); |
||||
|
return "调用成功"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param message |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@GetMapping("/sendHello") |
||||
|
public EventMenuNoticeDto say(@RequestBody EventMenuNoticeDto message) throws Exception { |
||||
|
template.convertAndSend(WebSocketConstant.MENU_NOTICE_TOPIC.concat("/getResponse"), message); |
||||
|
return message; |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.constants.WebSocketConstant; |
||||
|
import com.elink.esua.epdc.dto.EventMenuNoticeDto; |
||||
|
import com.google.common.collect.Maps; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.messaging.simp.SimpMessageSendingOperations; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author rongchao |
||||
|
* @Date 19-10-28 |
||||
|
*/ |
||||
|
@RequestMapping("eventMenu") |
||||
|
@RestController |
||||
|
public class MenuNoticController { |
||||
|
|
||||
|
@Autowired |
||||
|
private SimpMessageSendingOperations template; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param message |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@GetMapping("notice") |
||||
|
public String eventMenuNotice(@RequestBody EventMenuNoticeDto message) { |
||||
|
Map<String, Object> map = Maps.newHashMap(); |
||||
|
map.put("menuCode", message.getMenuCode()); |
||||
|
map.put("num", message.getNum()); |
||||
|
template.convertAndSendToUser( |
||||
|
message.getUserId(), |
||||
|
WebSocketConstant.MENU_NOTICE_QUEUE.concat("/menu/getResponse"), |
||||
|
map |
||||
|
); |
||||
|
return "调用成功"; |
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.exception; |
||||
|
|
||||
|
|
||||
|
import com.elink.esua.epdc.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,58 @@ |
|||||
|
package com.elink.esua.epdc.interceptor; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
import com.elink.esua.epdc.jwt.JwtTokenUtils; |
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.server.ServerHttpRequest; |
||||
|
import org.springframework.http.server.ServerHttpResponse; |
||||
|
import org.springframework.http.server.ServletServerHttpRequest; |
||||
|
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; |
||||
|
import org.springframework.messaging.support.MessageHeaderAccessor; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.socket.WebSocketHandler; |
||||
|
import org.springframework.web.socket.server.HandshakeInterceptor; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 拦截器 |
||||
|
* |
||||
|
* @author rongchao |
||||
|
* @Date 19-10-25 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class MyHandShakeInterceptor implements HandshakeInterceptor { |
||||
|
|
||||
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenUtils jwtUtil; |
||||
|
|
||||
|
@Override |
||||
|
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, |
||||
|
Map<String, Object> attributes) throws Exception { |
||||
|
HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest(); |
||||
|
|
||||
|
//获取用户token
|
||||
|
String token = servletRequest.getHeader(Constant.TOKEN_HEADER); |
||||
|
if(StringUtils.isEmpty(token)) { |
||||
|
return true; |
||||
|
} |
||||
|
Claims claims = jwtUtil.getClaimByToken(token); |
||||
|
String userId = claims.getSubject(); |
||||
|
attributes.put(Constant.USER_KEY, userId); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Exception ex) { |
||||
|
|
||||
|
// System.out.println(this.getClass().getCanonicalName() + "握手成功后...");
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* |
||||
|
* https://www.renren.io
|
||||
|
* |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.jwt; |
||||
|
|
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
/** |
||||
|
* Jwt |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
@ConfigurationProperties(prefix = "jwt.token") |
||||
|
public class JwtTokenProperties { |
||||
|
private String secret; |
||||
|
private int expire; |
||||
|
|
||||
|
public String getSecret() { |
||||
|
return secret; |
||||
|
} |
||||
|
|
||||
|
public void setSecret(String secret) { |
||||
|
this.secret = secret; |
||||
|
} |
||||
|
|
||||
|
public int getExpire() { |
||||
|
return expire; |
||||
|
} |
||||
|
|
||||
|
public void setExpire(int expire) { |
||||
|
this.expire = expire; |
||||
|
} |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.jwt; |
||||
|
|
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import io.jsonwebtoken.Jwts; |
||||
|
import io.jsonwebtoken.SignatureAlgorithm; |
||||
|
import org.joda.time.DateTime; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Jwt工具类 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class JwtTokenUtils { |
||||
|
private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private JwtTokenProperties jwtProperties; |
||||
|
|
||||
|
/** |
||||
|
* 生成jwt token |
||||
|
*/ |
||||
|
public String generateToken(String userId) { |
||||
|
return Jwts.builder() |
||||
|
.setHeaderParam("typ", "JWT") |
||||
|
.setSubject(userId) |
||||
|
.setIssuedAt(new Date()) |
||||
|
.setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate()) |
||||
|
.signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) |
||||
|
.compact(); |
||||
|
} |
||||
|
|
||||
|
public Claims getClaimByToken(String token) { |
||||
|
try { |
||||
|
return Jwts.parser() |
||||
|
.setSigningKey(jwtProperties.getSecret()) |
||||
|
.parseClaimsJws(token) |
||||
|
.getBody(); |
||||
|
} catch (Exception e) { |
||||
|
logger.debug("validate is token error, token = " + token, e); |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* token是否过期 |
||||
|
* |
||||
|
* @return true:过期 |
||||
|
*/ |
||||
|
public boolean isTokenExpired(Date expiration) { |
||||
|
return expiration.before(new Date()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.utils; |
||||
|
|
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
|
||||
|
/** |
||||
|
* 模块常量 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.1.0 |
||||
|
*/ |
||||
|
public interface ModuleConstant extends Constant { |
||||
|
|
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
server: |
||||
|
port: @server.port@ |
||||
|
servlet: |
||||
|
context-path: /ws |
||||
|
|
||||
|
spring: |
||||
|
application: |
||||
|
name: epdc-websocket-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@ |
||||
|
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 |
||||
|
jwt: |
||||
|
token: |
||||
|
#秘钥 |
||||
|
secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epdc] |
||||
|
#token有效时长,默认7天,单位秒 |
||||
|
expire: 604800 |
@ -0,0 +1 @@ |
|||||
|
#Default |
@ -0,0 +1 @@ |
|||||
|
#English |
@ -0,0 +1 @@ |
|||||
|
#\u7B80\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||||
|
#\u7E41\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||||
|
#Default |
@ -0,0 +1 @@ |
|||||
|
#English |
@ -0,0 +1 @@ |
|||||
|
#\u7B80\u4F53\u4E2D\u6587 |
@ -0,0 +1 @@ |
|||||
|
#\u7E41\u4F53\u4E2D\u6587 |
@ -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/websocket"/> |
||||
|
|
||||
|
<!-- 彩色日志格式 --> |
||||
|
<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.elink.esua.epdc" level="INFO"/> |
||||
|
<logger name="com.elink.esua.epdc.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.elink.esua.epdc" 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,22 @@ |
|||||
|
<?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> |
||||
|
|
||||
|
<groupId>com.esua.epdc.yushan</groupId> |
||||
|
<artifactId>epdc-cloud-websocket-yushan</artifactId> |
||||
|
<version>1.0.0</version> |
||||
|
|
||||
|
<packaging>pom</packaging> |
||||
|
<description>榆山党群e事通互帮互助模块</description> |
||||
|
|
||||
|
<modules> |
||||
|
<module>epdc-cloud-websocket</module> |
||||
|
<!-- <module>epdc-cloud-client-yushan</module>--> |
||||
|
<!-- <module>epdc-cloud-commons-yushan</module>--> |
||||
|
<!-- <module>epdc-cloud-gateway-yushan</module>--> |
||||
|
<!-- <module>epdc-cloud-parent-yushan</module>--> |
||||
|
</modules> |
||||
|
|
||||
|
</project> |
Loading…
Reference in new issue