Commit d0647d17 authored by 杨锐's avatar 杨锐

zipkin一致性追踪

parent c77d9b40
......@@ -5,7 +5,7 @@
<parent>
<groupId>cn.quantgroup</groupId>
<artifactId>commons-parent</artifactId>
<version>0.2.5.3</version>
<version>0.2.6-SNAPSHOT</version>
</parent>
<artifactId>xyqb-user2</artifactId>
......
package cn.quantgroup.xyqb.config.event;
import cn.quantgroup.tech.brave.service.ITechExecutorServiceBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -8,6 +9,7 @@ import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.support.TaskUtils;
import javax.annotation.Resource;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
......@@ -16,6 +18,9 @@ import java.util.concurrent.ThreadPoolExecutor;
@Configuration
public class EventConfig {
@Resource
private ITechExecutorServiceBuilder techExecutorServiceBuilder;
@Bean
public ApplicationEventMulticaster applicationEventMulticaster(Executor taskExecutor) {
SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new SimpleApplicationEventMulticaster();
......@@ -35,7 +40,7 @@ public class EventConfig {
poolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true);
poolTaskExecutor.setRejectedExecutionHandler(new RejectedHandler());
poolTaskExecutor.initialize();
return poolTaskExecutor;
return techExecutorServiceBuilder.buildExecutorService(poolTaskExecutor.getThreadPoolExecutor());
}
public static class RejectedHandler implements RejectedExecutionHandler {
......
......@@ -26,13 +26,13 @@ public class PhoneHashEventListener implements ApplicationListener<RegisterEvent
@Override
public void onApplicationEvent(RegisterEvent event) {
log.info("onApplicationEvent cn.quantgroup.xyqb.event.PhoneHashEventListener start");
UserRegisterParam userRegisterParam = event.getUserRegisterParam();
String phoneNo = userRegisterParam.getPhoneNo();
Long userId = userRegisterParam.getUser().getId();
String idNo = userRegisterParam.getIdNo();
/* modify by yangrui on 2019/12/16 下午5:47 */
UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findByUserId(userId);
if (userHashPhoneNoIdNoMapping == null) {
userHashPhoneNoIdNoMapping = new UserHashPhoneNoIdNoMapping(userId);
......
......@@ -29,6 +29,7 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
@Override
public void onApplicationEvent(UserDetailUpdateEvent event) {
log.info("onApplicationEvent cn.quantgroup.xyqb.event.UserDetailHashEventListener start");
UserDetail userDetail = event.getUserDetail();
UserHashMapping userHashMapping = userHashMappingRepository.findByUserId(userDetail.getUserId());
......@@ -51,7 +52,6 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
log.error("保存userHashMapping重复, 无需再保存, userId:{}", userDetail.getUserId());
}
/* modify by yangrui on 2019/12/16 下午5:48 */
UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findByUserId(userDetail.getUserId());
//如果不存在, 我先保存一下
......
......@@ -3,12 +3,14 @@ package cn.quantgroup.xyqb.event;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.WechatUserInfo;
import cn.quantgroup.xyqb.service.wechat.IWechatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import java.util.Objects;
@Slf4j
@Component
public class WechatPhoneNoUpdateEventListener implements ApplicationListener<PhoneNoUpdateEvent> {
......@@ -17,6 +19,7 @@ public class WechatPhoneNoUpdateEventListener implements ApplicationListener<Pho
@Override
public void onApplicationEvent(PhoneNoUpdateEvent event) {
log.info("onApplicationEvent cn.quantgroup.xyqb.event.WechatPhoneNoUpdateEventListener start");
String oldPhoneNo = event.getOldPhoneNo();
User user = event.getUser();
WechatUserInfo userInfo = wechatService.findWechatUserInfoByPhoneNo(oldPhoneNo);
......
......@@ -203,7 +203,6 @@ public class UserServiceImpl implements IUserService {
md5Value = md5Value.toLowerCase();
long value = HashUtil.crc32(md5Value);
UserHashMapping userHashMapping;
/* modify by yangrui on 2019/12/13 上午11:52 */
if (FindByMd5Enum.PHONENO.getType() == type) {
userHashMapping = userHashMappingRepository.findByPhoneNoMd5ShortAndPhoneNoMd5(value, md5Value);
} else if (FindByMd5Enum.IDNO.getType() == type) {
......
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