544 changed files with 803 additions and 10031 deletions
@ -1,6 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
|||
<mapping directory="" vcs="Git" /> |
|||
</component> |
|||
</project> |
File diff suppressed because it is too large
@ -1,57 +0,0 @@ |
|||
#服务端点暴露 |
|||
management: |
|||
endpoints: |
|||
web: |
|||
exposure: |
|||
# 暴露xxx端点,如需暴露多个,用,分隔;如需暴露所有端点,用'*' |
|||
include: auditevents,caches,conditions,flyway,health,heapdump,httptrace,info,integrationgraph,jolokia,logfile,loggers,liquibase,metrics,mappings,prometheus,scheduledtasks,sessions,shutdown,threaddump,hystrix.stream |
|||
# # 不暴露哪些端点 |
|||
# exclude: env,beans,configprops |
|||
endpoint: |
|||
health: |
|||
# 是否展示健康检查详情 |
|||
show-details: always |
|||
health: |
|||
redis: |
|||
enabled: false |
|||
#eureka注册 |
|||
eureka: |
|||
client: |
|||
service-url: |
|||
# 指定eureka server通信地址,注意/eureka/小尾巴不能少 |
|||
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ |
|||
defaultZone: http://admin:admin@127.0.0.1:8761/eureka/ |
|||
instance: |
|||
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server |
|||
prefer-ip-address: true |
|||
metadata-map: |
|||
management: |
|||
context-path: ${server.servlet.context-path}/actuator |
|||
home-page-url-path: ${server.servlet.context-path} |
|||
status-page-url-path: ${server.servlet.context-path}/actuator/info |
|||
health-check-url-path: ${server.servlet.context-path}/actuator/health |
|||
feign: |
|||
client: |
|||
config: |
|||
default: |
|||
connectTime: 5000 |
|||
readTimeout: 5000 |
|||
# NONE【性能最佳,适用于生产】:不记录任何日志(默认值)。 |
|||
# BASIC【适用于生产环境追踪问题】:仅记录请求方法、URL、响应状态代码以及执行时间。 |
|||
# HEADERS:记录BASIC级别的基础上,记录请求和响应的header。 |
|||
# FULL【比较适用于开发及测试环境定位问题】:记录请求和响应的header、body和元数据 |
|||
loggerLevel: basic |
|||
hystrix: |
|||
enabled: true |
|||
# sleuth |
|||
logging: |
|||
level: |
|||
root: info |
|||
org.springframework.cloud.sleuth: DEBUG |
|||
spring: |
|||
zipkin: |
|||
base-url: http://anyring.cc:9411 |
|||
sleuth: |
|||
sampler: |
|||
# 采样率,模式0.1,也就是10%,为了便于观察效果,改为1.0,也就是100%。生产环境建议保持默认。 |
|||
probability: 1.0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,92 @@ |
|||
package com.ccsens.ht.config; |
|||
|
|||
|
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import com.ccsens.util.config.DruidProps; |
|||
import com.fasterxml.jackson.databind.DeserializationFeature; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.fasterxml.jackson.databind.module.SimpleModule; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.http.converter.HttpMessageConverter; |
|||
import org.springframework.http.converter.StringHttpMessageConverter; |
|||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; |
|||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
|
|||
import javax.sql.DataSource; |
|||
import java.nio.charset.Charset; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
@Configuration |
|||
//public class SpringConfig extends WebMvcConfigurationSupport {
|
|||
public class SpringConfig implements WebMvcConfigurer { |
|||
@Autowired |
|||
private DruidProps druidPropsUtil; |
|||
@Value("${spring.snowflake.workerId}") |
|||
private String workerId; |
|||
@Value("${spring.snowflake.datacenterId}") |
|||
private String datacenterId; |
|||
|
|||
/** |
|||
* 配置Converter |
|||
* @return |
|||
*/ |
|||
@Bean |
|||
public HttpMessageConverter<String> responseStringConverter() { |
|||
StringHttpMessageConverter converter = new StringHttpMessageConverter( |
|||
Charset.forName("UTF-8")); |
|||
return converter; |
|||
} |
|||
|
|||
@Bean |
|||
public HttpMessageConverter<Object> responseJsonConverter(){ |
|||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); |
|||
List<MediaType> mediaTypeList = new ArrayList<>(); |
|||
mediaTypeList.add(MediaType.TEXT_HTML); |
|||
mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8); |
|||
converter.setSupportedMediaTypes(mediaTypeList); |
|||
|
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
SimpleModule simpleModule = new SimpleModule(); |
|||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance); |
|||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); |
|||
objectMapper.registerModule(simpleModule); |
|||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
|||
converter.setObjectMapper(objectMapper); |
|||
|
|||
return converter; |
|||
} |
|||
|
|||
@Override |
|||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
|||
converters.add(responseStringConverter()); |
|||
converters.add(responseJsonConverter()); |
|||
} |
|||
|
|||
@Override |
|||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { |
|||
configurer.favorPathExtension(false); |
|||
} |
|||
|
|||
/** |
|||
* 配置数据源(单数据源) |
|||
*/ |
|||
@Bean |
|||
public DataSource dataSource(){ |
|||
return druidPropsUtil.createDruidDataSource(); |
|||
} |
|||
|
|||
@Bean |
|||
public Snowflake snowflake(){ |
|||
return IdUtil.createSnowflake(Long.valueOf(workerId),Long.valueOf(datacenterId)); |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.ccsens.tall.config; |
|||
|
|||
import com.ccsens.tall.bean.po.SysUser; |
|||
import com.ccsens.tall.service.IUserService; |
|||
import com.ccsens.util.*; |
|||
import io.jsonwebtoken.Claims; |
|||
import io.jsonwebtoken.ExpiredJwtException; |
|||
import io.jsonwebtoken.SignatureException; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.servlet.HandlerInterceptor; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
public class TokenInterceptor implements HandlerInterceptor { |
|||
@Autowired |
|||
private IUserService userService; |
|||
|
|||
@Override |
|||
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { |
|||
// 验证token是否存在
|
|||
final String authHeader = httpServletRequest.getHeader(WebConstant.HEADER_KEY_TOKEN); |
|||
if (authHeader == null || !authHeader.startsWith(WebConstant.HEADER_KEY_TOKEN_PREFIX)) { |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().tokenNotFound())); |
|||
return false; |
|||
} |
|||
final String token = authHeader.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length()); |
|||
|
|||
//验证token是否有效
|
|||
Claims claims = null; |
|||
try { |
|||
claims = JwtUtil.parseJWT(token, WebConstant.JWT_ACCESS_TOKEN_SECERT); |
|||
}catch(SignatureException e){ |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().tokenSignatureFail(e.getMessage()))); |
|||
return false; |
|||
}catch(ExpiredJwtException e){ |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().tokenExpire(e.getMessage()))); |
|||
return false; |
|||
}catch(Exception e){ |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().tokenFailed(e.getMessage()))); |
|||
return false; |
|||
} |
|||
|
|||
//验证用户存根
|
|||
if(userService.tokenNotExistInCache(Long.valueOf(claims.getSubject()))){ |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().tokenStubNotFound())); |
|||
return false; |
|||
} |
|||
|
|||
//验证用户是否禁用
|
|||
SysUser user = userService.getUserById(Long.valueOf(claims.getSubject())); |
|||
if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){ |
|||
HttpServletUtil.responseJson(httpServletResponse, |
|||
JacksonUtil.beanToJson(JsonResponse.newInstance().userDisabled())); |
|||
return false; |
|||
} |
|||
|
|||
//在request中存放claims
|
|||
httpServletRequest.setAttribute(WebConstant.REQUEST_KEY_CLAIMS,claims); |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { |
|||
|
|||
} |
|||
} |
@ -1,30 +0,0 @@ |
|||
logging: |
|||
level: |
|||
com: |
|||
favorites: DEBUG |
|||
org: |
|||
hibernate: ERROR |
|||
springframework: |
|||
web: DEBUG |
|||
mybatis: |
|||
config-location: classpath:mybatis/mybatis-config.xml |
|||
mapper-locations: classpath*:mapper_*/*.xml |
|||
type-aliases-package: com.ccsens.ht.bean |
|||
server: |
|||
tomcat: |
|||
uri-encoding: UTF-8 |
|||
spring: |
|||
http: |
|||
encoding: |
|||
charset: UTF-8 |
|||
enabled: true |
|||
force: true |
|||
log-request-details: true |
|||
servlet: |
|||
multipart: |
|||
max-file-size: 10MB |
|||
max-request-size: 100MB |
|||
snowflake: |
|||
datacenterId: 1 |
|||
workerId: 1 |
|||
|
@ -1,28 +0,0 @@ |
|||
server: |
|||
port: 8080 |
|||
servlet: |
|||
context-path: /v1.0 |
|||
spring: |
|||
application: |
|||
name: tall |
|||
datasource: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
rabbitmq: |
|||
host: api.ccsens.com |
|||
password: 111111 |
|||
port: 5672 |
|||
username: admin |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1ms |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000ms |
|||
swagger: |
|||
enable: true |
@ -1,26 +0,0 @@ |
|||
server: |
|||
port: 8081 |
|||
spring: |
|||
application: |
|||
name: tall |
|||
datasource: |
|||
type: com.alibaba.druid.pool.DruidDataSource |
|||
rabbitmq: |
|||
host: api.ccsens.com |
|||
password: 111111 |
|||
port: 5672 |
|||
username: admin |
|||
redis: |
|||
database: 0 |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: 200 |
|||
max-idle: 10 |
|||
max-wait: -1ms |
|||
min-idle: 0 |
|||
password: '' |
|||
port: 6379 |
|||
timeout: 1000ms |
|||
swagger: |
|||
enable: true |
@ -1,4 +0,0 @@ |
|||
spring: |
|||
profiles: |
|||
active: dev |
|||
include: util-dev,common |
@ -1,9 +0,0 @@ |
|||
business: |
|||
packet: |
|||
## 红包默认过期时间(ms) |
|||
expiretime: 7*24*3600*1000 |
|||
## 发红包手续费率 |
|||
rate: 0.01 |
|||
## 发红包手续费率 |
|||
toplimit: 500.0 |
|||
name: zs |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue