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

Commit f3313a0c authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/dev' into dev

parents b923325b fe485238
package com.liquidnet.common.web.config;
import com.liquidnet.common.web.filter.GlobalLogTrackInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
// @Autowired
// GlobalAuthorityInterceptor globalAuthorityInterceptor;
@Autowired
GlobalLogTrackInterceptor globalLogTrackInterceptor;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
......@@ -26,11 +29,11 @@ public class WebMvcConfig extends WebMvcConfigurationSupport {
super.addResourceHandlers(registry);
}
// @Override
// protected void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(globalAuthorityInterceptor).addPathPatterns("/**");
// super.addInterceptors(registry);
// }
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(globalLogTrackInterceptor).addPathPatterns("/**");
super.addInterceptors(registry);
}
// @Bean
// public FilterRegistrationBean domainCrossFilterBean(){
......
......@@ -11,6 +11,7 @@ import io.jsonwebtoken.ExpiredJwtException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
......@@ -38,7 +39,6 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
private static final String TOKEN_KICK = "40002";
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";
......@@ -55,8 +55,6 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
@Override
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(),
responseCode = null, token = null, currentUid = null;
......@@ -103,15 +101,6 @@ public class GlobalAuthorityInterceptor extends HandlerInterceptorAdapter {
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(START_TIME);
log.info("[{}]耗时:{}s", request.getRequestURI(), ((endTime - startTime) * 1.000) / 1000);
// }
}
private void responseHandler(HttpServletResponse response, String responseCode) throws IOException {
ResponseDto<Object> responseDto = ResponseDto.failure(ErrorMapping.get(responseCode));
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
......
package com.liquidnet.common.web.filter;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j
@Data
@Component
public class GlobalLogTrackInterceptor extends HandlerInterceptorAdapter {
private static final String LNS_TRANCE_ID = "lnsTranceId";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String t = MDC.get(LNS_TRANCE_ID);
MDC.put(LNS_TRANCE_ID, null == t ? String.valueOf(System.nanoTime()) : t);
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
long e = Long.parseLong(MDC.get(LNS_TRANCE_ID));
log.info("[{}]耗时:{}ms", request.getRequestURI(), (System.nanoTime() - e) / 1000000);
MDC.clear();
}
}
......@@ -24,8 +24,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: ${liquidnet.logfile.file-max-size}
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -18,8 +18,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: 200MB
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{26}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{26}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -18,8 +18,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: 200MB
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{26}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{26}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -24,8 +24,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: ${liquidnet.logfile.file-max-size}
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -24,8 +24,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: ${liquidnet.logfile.file-max-size}
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -24,8 +24,8 @@ logging:
name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}.log
max-size: ${liquidnet.logfile.file-max-size}
pattern:
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [ %-5level] %thread [%logger{96}:%line] - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %X{lnsTranceId} [%logger{96}:%line] - %msg%n'
rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level:
root: info
......
......@@ -25,7 +25,7 @@ import java.io.IOException;
*/
@Slf4j
@Component
public class ConsumerAdamProcessor {
public class ConsumerAdamUCenterProcessor {
@Resource
IBaseDao baseDao;
......@@ -81,115 +81,43 @@ public class ConsumerAdamProcessor {
/* ================================================================== | 用户注册 */
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
))
public void consumerSqlForURegisterA(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
))
public void consumerSqlForURegisterB(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
))
public void consumerSqlForURegisterC(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
))
public void consumerSqlForURegisterD(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
))
public void consumerSqlForURegisterE(Message msg, Channel channel) {
@RabbitListener(
bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER),
key = MQConst.RK_SQL_UREGISTER,
value = @Queue(MQConst.QUEUES_SQL_UREGISTER)
),
concurrency = "5"
)
public void consumerSqlForURegister(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
/* ================================================================== | 用户信息 */
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
))
public void consumerSqlForUCenterA(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
))
public void consumerSqlForUCenterB(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
))
public void consumerSqlForUCenterC(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
))
public void consumerSqlForUCenterD(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
))
public void consumerSqlForUCenterE(Message msg, Channel channel) {
@RabbitListener(
bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER),
key = MQConst.RK_SQL_UCENTER,
value = @Queue(MQConst.QUEUES_SQL_UCENTER)
),
concurrency = "5"
)
public void consumerSqlForUCenter(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
/* ================================================================== | 会员购买 */
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
))
public void consumerSqlForUMemberA(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
))
public void consumerSqlForUMemberB(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
))
public void consumerSqlForUMemberC(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
))
public void consumerSqlForUMemberD(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
@RabbitListener(bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER), key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
))
public void consumerSqlForUMemberE(Message msg, Channel channel) {
@RabbitListener(
bindings = @QueueBinding(
exchange = @Exchange(MQConst.EX_LNS_SQL_UCENTER),
key = MQConst.RK_SQL_UMEMBER,
value = @Queue(MQConst.QUEUES_SQL_UMEMBER)
),
concurrency = "5"
)
public void consumerSqlForUMember(Message msg, Channel channel) {
this.consumerSqlDaoHandler(msg, channel);
}
......
......@@ -8,9 +8,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class ConsumerAdamProcessorTest {
public class ConsumerAdamUCenterProcessorTest {
@Autowired
ConsumerAdamProcessor consumerAdamProcessor;
ConsumerAdamUCenterProcessor consumerAdamUCenterProcessor;
@Test
public void test() {
......
......@@ -4,7 +4,7 @@ db.createCollection("KylinCheckUserPerformanceVo");
db.createCollection("KylinCheckUserVo");
db.createCollection("KylinOrderRefundEntitiesVo");
db.createCollection("KylinOrderRefundPicVo");
db.createCollection("KylinOrderRefundsVoBase");
db.createCollection("KylinOrderRefundsVo");
db.createCollection("KylinOrderTicketEntitiesVo");
db.createCollection("KylinOrderTicketVo");
db.createCollection("KylinPerformanceVo");
......@@ -21,8 +21,8 @@ db.KylinCheckUserVo.createIndex({mobile:"hashed"});
db.KylinOrderRefundEntitiesVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundEntitiesVo.createIndex({orderTicketEntitiesId:"hashed"});
db.KylinOrderRefundPicVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVoBase.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVoBase.createIndex({orderTicketsId:"hashed"});
db.KylinOrderRefundsVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVo.createIndex({orderTicketsId:"hashed"});
db.KylinOrderTicketEntitiesVo.createIndex({orderTicketEntitiesId:"hashed"});
db.KylinOrderTicketEntitiesVo.createIndex({orderId:"hashed"});
db.KylinOrderTicketVo.createIndex({orderTicketsId:"hashed"});
......@@ -42,7 +42,7 @@ sh.shardCollection("prod_ln_scene.KylinCheckUserPerformanceVo",{"checkUserId":"h
sh.shardCollection("prod_ln_scene.KylinCheckUserVo",{"checkUserId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderRefundEntitiesVo",{"orderRefundsEntitiesId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderRefundPicVo",{"refundPicId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderRefundsVoBase",{"orderRefundsId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderRefundsVo",{"orderRefundsId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderTicketEntitiesVo",{"orderTicketEntitiesId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinOrderTicketVo",{"orderTicketsId":"hashed"});
sh.shardCollection("prod_ln_scene.KylinPerformanceVo",{"performancesId":"hashed"});
......
......@@ -4,7 +4,7 @@ db.createCollection("KylinCheckUserPerformanceVo");
db.createCollection("KylinCheckUserVo");
db.createCollection("KylinOrderRefundEntitiesVo");
db.createCollection("KylinOrderRefundPicVo");
db.createCollection("KylinOrderRefundsVoBase");
db.createCollection("KylinOrderRefundsVo");
db.createCollection("KylinOrderTicketEntitiesVo");
db.createCollection("KylinOrderTicketVo");
db.createCollection("KylinPerformanceVo");
......@@ -21,8 +21,8 @@ db.KylinCheckUserVo.createIndex({mobile:"hashed"});
db.KylinOrderRefundEntitiesVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundEntitiesVo.createIndex({orderTicketEntitiesId:"hashed"});
db.KylinOrderRefundPicVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVoBase.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVoBase.createIndex({orderTicketsId:"hashed"});
db.KylinOrderRefundsVo.createIndex({orderRefundsId:"hashed"});
db.KylinOrderRefundsVo.createIndex({orderTicketsId:"hashed"});
db.KylinOrderTicketEntitiesVo.createIndex({orderTicketEntitiesId:"hashed"});
db.KylinOrderTicketEntitiesVo.createIndex({orderId:"hashed"});
db.KylinOrderTicketVo.createIndex({orderTicketsId:"hashed"});
......@@ -42,7 +42,7 @@ sh.shardCollection("test_ln_scene.KylinCheckUserPerformanceVo",{"checkUserId":"h
sh.shardCollection("test_ln_scene.KylinCheckUserVo",{"checkUserId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderRefundEntitiesVo",{"orderRefundsEntitiesId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderRefundPicVo",{"refundPicId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderRefundsVoBase",{"orderRefundsId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderRefundsVo",{"orderRefundsId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderTicketEntitiesVo",{"orderTicketEntitiesId":"hashed"});
sh.shardCollection("test_ln_scene.KylinOrderTicketVo",{"orderTicketsId":"hashed"});
sh.shardCollection("test_ln_scene.KylinPerformanceVo",{"performancesId":"hashed"});
......
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