Browse Source

Merge branch 'yanyuan' of dd.tall.wiki:ccsens_wiki/ccsenscloud into yanyuan

yanyuan
zy_Java 4 years ago
parent
commit
5bf658b7dc
  1. 10
      cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java
  2. 145
      cloudutil/src/main/resources/application-util-pre.yml
  3. 2
      cloudutil/src/main/resources/application-util-test.yml
  4. 4
      signin/src/main/resources/application.yml
  5. 2
      signin/src/main/resources/druid-test.yml

10
cloudutil/src/main/java/com/ccsens/cloudutil/aspect/MustLoginAspect.java

@ -5,13 +5,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.cloudutil.feign.Tall3FeignClient; import com.ccsens.cloudutil.feign.Tall3FeignClient;
import com.ccsens.cloudutil.feign.TallFeignClient;
import com.ccsens.util.CodeEnum; import com.ccsens.util.CodeEnum;
import com.ccsens.util.JsonResponse; import com.ccsens.util.JsonResponse;
import com.ccsens.util.WebConstant; import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.bean.dto.QueryDto;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature; import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
@ -27,7 +25,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -72,7 +69,7 @@ public class MustLoginAspect {
Method targetMethod = methodSignature.getMethod(); Method targetMethod = methodSignature.getMethod();
MustLogin mustLoginAnnotation = targetMethod.getAnnotation(MustLogin.class); MustLogin mustLoginAnnotation = targetMethod.getAnnotation(MustLogin.class);
fillSeptial(dto, mustLoginAnnotation); fillSpecial(dto, mustLoginAnnotation);
if (mustLoginAnnotation == null) { if (mustLoginAnnotation == null) {
log.info("不是必须登录,有token,则添加userId,没有则不添加"); log.info("不是必须登录,有token,则添加userId,没有则不添加");
if (response != null && response.getCode().intValue() == CodeEnum.SUCCESS.getCode().intValue() && response.getData() != null) { if (response != null && response.getCode().intValue() == CodeEnum.SUCCESS.getCode().intValue() && response.getData() != null) {
@ -122,7 +119,10 @@ public class MustLoginAspect {
return result; return result;
} }
private void fillSeptial(QueryDto dto, MustLogin mustLoginAnnotation) { private void fillSpecial(QueryDto dto, MustLogin mustLoginAnnotation) {
if (mustLoginAnnotation == null) {
return;
}
if (dto != null && mustLoginAnnotation.type() > -1) { if (dto != null && mustLoginAnnotation.type() > -1) {
switch (mustLoginAnnotation.type()) { switch (mustLoginAnnotation.type()) {
case 0: case 0:

145
cloudutil/src/main/resources/application-util-pre.yml

@ -0,0 +1,145 @@
#<<<<<<< HEAD
##服务端点暴露
#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@49.233.89.188:7010/eureka/
# defaultZone: http://admin:admin@192.168.0.99:7010/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://49.233.89.188:9411
## sleuth:
## sampler:
## # 采样率,模式0.1,也就是10%,为了便于观察效果,改为1.0,也就是100%。生产环境建议保持默认。
## probability: 1.0
# cloud:
# inetutils:
#=======
#服务端点暴露
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@101.201.226.21:7010/eureka/
# defaultZone: http://admin:admin@121.36.3.207:7010/eureka/
defaultZone: http://admin:admin@127.0.0.1:7010/eureka/
# defaultZone: http://admin:admin@test.tall.wiki:7010/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: 60000
readTimeout: 60000
# NONE【性能最佳,适用于生产】:不记录任何日志(默认值)。
# BASIC【适用于生产环境追踪问题】:仅记录请求方法、URL、响应状态代码以及执行时间。
# HEADERS:记录BASIC级别的基础上,记录请求和响应的header。
# FULL【比较适用于开发及测试环境定位问题】:记录请求和响应的header、body和元数据
loggerLevel: basic
hystrix:
enabled: true
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: THREAD
thread:
timeoutInMilliseconds: 60000
threadpool:
default:
coreSize: 200 #并发执行的最大线程数,默认10
maxQueueSize: 1000 #BlockingQueue的最大队列数,默认值-1
queueSizeRejectionThreshold: 800 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
# sleuth
logging:
level:
root: info
org.springframework.cloud.sleuth: DEBUG
spring:
# zipkin:
# base-url: http://49.233.89.188:9411
# sleuth:
# sampler:
# # 采样率,模式0.1,也就是10%,为了便于观察效果,改为1.0,也就是100%。生产环境建议保持默认。
# probability: 1.0
cloud:
inetutils:
ignored-interfaces: ['VMware.*']

2
cloudutil/src/main/resources/application-util-test.yml

@ -117,7 +117,7 @@ hystrix:
timeout: timeout:
enabled: true enabled: true
isolation: isolation:
strategy: SEMAPHORE strategy: THREAD
thread: thread:
timeoutInMilliseconds: 60000 timeoutInMilliseconds: 60000
threadpool: threadpool:

4
signin/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring: spring:
profiles: profiles:
active: dev active: test
include: util-dev,common include: util-test,common

2
signin/src/main/resources/druid-test.yml

@ -29,7 +29,7 @@ spring:
testWhileIdle: true testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 60000
# url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8 # url: jdbc:mysql://127.0.0.1/tall?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://test.tall.wiki/tall3?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true url: jdbc:mysql://test.tall.wiki/tall3_bak?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
username: root username: root
validationQuery: SELECT 1 FROM DUAL validationQuery: SELECT 1 FROM DUAL
env: CCSENS_TALL env: CCSENS_TALL
Loading…
Cancel
Save