记得上下班打卡 | git大法好,push需谨慎

Commit 89bc42f0 authored by 张国柄's avatar 张国柄

fix:dev|test +接口耗时;

添加入场人证件号后台正则校验逻辑删除;
parent e093c971
...@@ -23,6 +23,6 @@ public class AdamEntersParam implements java.io.Serializable { ...@@ -23,6 +23,6 @@ public class AdamEntersParam implements java.io.Serializable {
@NotNull @Min(1) @Max(5) @NotNull @Min(1) @Max(5)
private Integer type; private Integer type;
@ApiModelProperty(position = 14, required = true, value = "入场人证件号[11]", example = "110101110001010111") @ApiModelProperty(position = 14, required = true, value = "入场人证件号[11]", example = "110101110001010111")
@Pattern(regexp = LnsRegex.Valid.CHINESE_ID_CARD, message = "身份证号格式有误") // @Pattern(regexp = LnsRegex.Valid.CHINESE_ID_CARD, message = "身份证号格式有误")
private String idCard; private String idCard;
} }
...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
...@@ -37,10 +38,16 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter { ...@@ -37,10 +38,16 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
private static final String TOKEN_KICK = "40002"; private static final String TOKEN_KICK = "40002";
private static final String TOKEN_INVALID = "40003"; private static final String TOKEN_INVALID = "40003";
private static final String START_TIME = "_startTime";
private static final String ENV_PROD = "prod";
private static final String ENV_ACTIVE = "spring.profiles.active";
private static final String KYLIN_STATION_JWT_VALID = "/station/**"; private static final String KYLIN_STATION_JWT_VALID = "/station/**";
private final static AntPathMatcher antPathMatcher = new AntPathMatcher(); private final static AntPathMatcher antPathMatcher = new AntPathMatcher();
@Autowired
Environment env;
@Autowired @Autowired
JwtValidator jwtValidator; JwtValidator jwtValidator;
@Autowired @Autowired
...@@ -48,6 +55,8 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter { ...@@ -48,6 +55,8 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
request.setAttribute(START_TIME, System.currentTimeMillis());
String authorization = request.getHeader(CurrentUtil.uToken), uri = request.getRequestURI(), String authorization = request.getHeader(CurrentUtil.uToken), uri = request.getRequestURI(),
responseCode = null, token = null, currentUid = null; responseCode = null, token = null, currentUid = null;
...@@ -91,6 +100,15 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter { ...@@ -91,6 +100,15 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
return false; return false;
} }
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
if (!StringUtils.equalsIgnoreCase(env.getProperty(ENV_ACTIVE), ENV_PROD)) {
Long endTime = System.currentTimeMillis();
Long startTime = (Long) request.getAttribute("_startTime");
log.info("[{}]耗时:{}s", request.getRequestURI(), ((endTime - startTime) * 1.000) / 1000);
}
}
private void responseHandler(HttpServletResponse response, String responseCode) throws IOException { private void responseHandler(HttpServletResponse response, String responseCode) throws IOException {
ResponseDto<Object> responseDto = ResponseDto.failure(ErrorMapping.get(responseCode)); ResponseDto<Object> responseDto = ResponseDto.failure(ErrorMapping.get(responseCode));
response.setCharacterEncoding(StandardCharsets.UTF_8.name()); response.setCharacterEncoding(StandardCharsets.UTF_8.name());
......
...@@ -137,10 +137,6 @@ spring: ...@@ -137,10 +137,6 @@ spring:
# ----------------------------------------------------------- # -----------------------------------------------------------
global-auth: global-auth:
exclude-url-pattern: exclude-url-pattern:
- ${liquidnet.info.context}/doc.html
- ${liquidnet.info.context}/webjars/**
- ${liquidnet.info.context}/swagger-resources/**
- ${liquidnet.info.context}/v2/api-docs*
- ${liquidnet.info.context}/login/* - ${liquidnet.info.context}/login/*
- ${liquidnet.info.context}/send - ${liquidnet.info.context}/send
- ${liquidnet.info.context}/member/info - ${liquidnet.info.context}/member/info
......
...@@ -138,10 +138,6 @@ spring: ...@@ -138,10 +138,6 @@ spring:
# ----------------------------------------------------------- # -----------------------------------------------------------
global-auth: global-auth:
exclude-url-pattern: exclude-url-pattern:
- ${liquidnet.info.context}/doc.html
- ${liquidnet.info.context}/webjars/**
- ${liquidnet.info.context}/swagger-resources/**
- ${liquidnet.info.context}/v2/api-docs*
- ${liquidnet.info.context}/station/login - ${liquidnet.info.context}/station/login
- ${liquidnet.info.context}/station/login/sms - ${liquidnet.info.context}/station/login/sms
# - # -
......
...@@ -81,6 +81,8 @@ create table adam_user_info ...@@ -81,6 +81,8 @@ create table adam_user_info
qr_code varchar(255) comment '身份二维码', qr_code varchar(255) comment '身份二维码',
qr_pic varchar(255) comment '身份二维码', qr_pic varchar(255) comment '身份二维码',
tag_me json comment '音乐标签', tag_me json comment '音乐标签',
rong_cloud_token varchar(64),
rong_cloud_tag tinyint,
comment text comment text
) engine = InnoDB comment '用户信息'; ) engine = InnoDB comment '用户信息';
......
...@@ -13,7 +13,9 @@ public class AdamWebMvcConfig extends WebMvcConfig { ...@@ -13,7 +13,9 @@ public class AdamWebMvcConfig extends WebMvcConfig {
@Override @Override
protected void addInterceptors(InterceptorRegistry registry) { protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(globalAuthorityInterceptor).addPathPatterns("/**"); registry.addInterceptor(globalAuthorityInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/*/v2/api-docs*", "/*/swagger-resources/**", "/*/webjars/**", "/doc.html");
super.addInterceptors(registry); super.addInterceptors(registry);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment