Commit a8f1b802 authored by 李健华's avatar 李健华

修改用户详细资料更新身份证mapping错误,已经删掉身份证Mapping表

parent c13ba89e
...@@ -2,16 +2,13 @@ package cn.quantgroup.xyqb.event; ...@@ -2,16 +2,13 @@ package cn.quantgroup.xyqb.event;
import cn.quantgroup.xyqb.entity.UserDetail; import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.entity.UserHashMapping; import cn.quantgroup.xyqb.entity.UserHashMapping;
import cn.quantgroup.xyqb.entity.UserHashPhoneNoIdNoMapping;
import cn.quantgroup.xyqb.repository.IUserHashMappingRepository; import cn.quantgroup.xyqb.repository.IUserHashMappingRepository;
import cn.quantgroup.xyqb.repository.IUserHashPhoneNoIdNoMappingRepository;
import cn.quantgroup.xyqb.util.encrypt.Md5Util; import cn.quantgroup.xyqb.util.encrypt.Md5Util;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.PersistenceException; import javax.persistence.PersistenceException;
...@@ -24,8 +21,8 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta ...@@ -24,8 +21,8 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
@Autowired @Autowired
private IUserHashMappingRepository userHashMappingRepository; private IUserHashMappingRepository userHashMappingRepository;
@Resource // @Resource
private IUserHashPhoneNoIdNoMappingRepository userHashPhoneNoIdNoMappingRepository; // private IUserHashPhoneNoIdNoMappingRepository userHashPhoneNoIdNoMappingRepository;
@Override @Override
public void onApplicationEvent(UserDetailUpdateEvent event) { public void onApplicationEvent(UserDetailUpdateEvent event) {
...@@ -51,21 +48,21 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta ...@@ -51,21 +48,21 @@ public class UserDetailHashEventListener implements ApplicationListener<UserDeta
log.warn("保存userHashMapping重复, 无需再保存, userId:{}", userDetail.getUserId()); log.warn("保存userHashMapping重复, 无需再保存, userId:{}", userDetail.getUserId());
} }
UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findByUserId(userDetail.getUserId()); // UserHashPhoneNoIdNoMapping userHashPhoneNoIdNoMapping = userHashPhoneNoIdNoMappingRepository.findByUserId(userDetail.getUserId());
//
//如果不存在, 我先保存一下 // //如果不存在, 我先保存一下
if (userHashPhoneNoIdNoMapping == null) { // if (userHashPhoneNoIdNoMapping == null) {
userHashPhoneNoIdNoMapping = new UserHashPhoneNoIdNoMapping(userDetail.getUserId()); // userHashPhoneNoIdNoMapping = new UserHashPhoneNoIdNoMapping(userDetail.getUserId());
} // }
//
//可能存在手机号、身份证号修改. 搞一下. // //可能存在手机号、身份证号修改. 搞一下.
String phoneNoIdNoMd5 = (userDetail.getPhoneNo() + userDetail.getIdNo()).toUpperCase(); // String phoneNoIdNoMd5 = (userDetail.getPhoneNo() + userDetail.getIdNo()).toUpperCase();
userHashPhoneNoIdNoMapping.setPhoneNoIdNoMd5(Md5Util.build(phoneNoIdNoMd5)); // userHashPhoneNoIdNoMapping.setPhoneNoIdNoMd5(Md5Util.build(phoneNoIdNoMd5));
//
try { // try {
userHashPhoneNoIdNoMappingRepository.save(userHashPhoneNoIdNoMapping); // userHashPhoneNoIdNoMappingRepository.save(userHashPhoneNoIdNoMapping);
} catch (PersistenceException e) { // } catch (PersistenceException e) {
log.error("保存userHashPhoneNoIdNoMapping重复, 无需再保存, userId:{}", userDetail.getUserId()); // log.error("保存userHashPhoneNoIdNoMapping重复, 无需再保存, userId:{}", userDetail.getUserId());
} // }
} }
} }
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