Commit f1716855 authored by zhouqian's avatar zhouqian

rename some method, clear the semantic

parent be2f3610
......@@ -76,7 +76,7 @@ public class InnerController {
createdAt = System.currentTimeMillis();
updatedAt = System.currentTimeMillis();
}
User user = userService.findByPhone(phoneNo);
User user = userService.findByPhoneWithCache(phoneNo);
if (user == null) {
user = new User();
}
......
......@@ -140,7 +140,7 @@ public class Jr58Controller implements ApplicationEventPublisherAware {
String uuid = jr58Service.register(param);
applicationEventPublisher.publishEvent(new UserinfoChangedEvent(this, uuid, Constants.Channel.JR58));
User user = xyqbUserService.findByUuid(uuid);
User user = xyqbUserService.findByUuidWithCache(uuid);
LOGGER.info("58金融运营商授权状态更新开始");
try {
jr58Service.getRidOfFillingProfile(user, param.getAccount());
......@@ -181,7 +181,7 @@ public class Jr58Controller implements ApplicationEventPublisherAware {
private Tuple<String, User> getEntryPointUrl(String uuid, String from) {
// 找到uuid,但是用户不在user表中,说明是老系统用户
User userInXyqb = xyqbUserService.findByUuid(uuid);
User userInXyqb = xyqbUserService.findByUuidWithCache(uuid);
if (userInXyqb != null) {
String token = authApiService.login(userInXyqb.getPhoneNo(), Constants.Channel.JR58);
......@@ -196,7 +196,7 @@ public class Jr58Controller implements ApplicationEventPublisherAware {
LOGGER.error("58金融运营商授权数据导入接口 - uuid对应的UuidPhoneMapping为空");
}
// 手机号在新系统中存在,说明之前已经注册过
userInXyqb = xyqbUserService.findByPhone(phoneNo);
userInXyqb = xyqbUserService.findByPhoneWithCache(phoneNo);
if (userInXyqb != null) {
String token = authApiService.login(phoneNo, Constants.Channel.JR58);
return new Tuple<>(String.format(ENTRY_POINT_URL_TEMPLATE, xyqbUrl, token), userInXyqb);
......
......@@ -58,7 +58,7 @@ public class SyncUserController {
return JsonResult.buildErrorStateResult(null, null);
}
String phoneNo = userDetail.getPhoneNo();
User user = userService.findByPhone(phoneNo);
User user = userService.findByPhoneWithCache(phoneNo);
if (null == user) {
return JsonResult.buildErrorStateResult(null, null);
}
......@@ -76,7 +76,7 @@ public class SyncUserController {
if (StringUtils.isEmpty(uuid)) {
return JsonResult.buildErrorStateResult(null, null);
}
User user = userService.findByUuid(uuid);
User user = userService.findByUuidWithCache(uuid);
if (null == user) {
return JsonResult.buildErrorStateResult(null, null);
}
......
package cn.quantgroup.xyqb.controller.external.user;
import cn.quantgroup.sms.SmsSender;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.api.IUserApiService;
......@@ -50,7 +49,7 @@ public class UserApiController {
if (!"abc1234".equals(key) || StringUtils.isEmpty(phoneNo)) {
return JsonResult.buildErrorStateResult(null, null);
}
User user = userService.findByPhone(phoneNo);
User user = userService.findByPhoneWithCache(phoneNo);
if (null == user) {
return JsonResult.buildErrorStateResult(null, null);
}
......
......@@ -82,7 +82,7 @@ public class UserController implements IBaseController {
}
String userName = credentialArr[0];
String pass = credentialArr[1];
User user = userService.findByPhone(userName);
User user = userService.findByPhoneWithCache(userName);
if(user == null){
return JsonResult.buildErrorStateResult("用户名或密码不正确", null);
}
......@@ -175,7 +175,7 @@ public class UserController implements IBaseController {
LOGGER.info("用户快速登录,验证码校验失败,phoneNo:{} , verificationCode:{}", phoneNo, verificationCode);
return JsonResult.buildErrorStateResult("验证码错误", null);
}
User user = userService.findByPhone(phoneNo);
User user = userService.findByPhoneWithCache(phoneNo);
if(user == null){
user = registerFastWhenLogin(phoneNo, channelId, createdFrom, appChannel);
if (user == null) {
......
......@@ -32,7 +32,7 @@ public class Jr58Notifier implements ApplicationListener<UserinfoChangedEvent> {
return;
}
User user = userService.findByUuid(uuid);
User user = userService.findByUuidWithCache(uuid);
if (user == null || user.getRegisteredFrom() != Constants.Channel.JR58) {
return;
}
......
......@@ -24,7 +24,7 @@ public class UserApiServiceImpl implements IUserApiService {
@Override
public boolean userImportCheck(String phoneNo) {
User user=userService.findByPhone(phoneNo);
User user=userService.findByPhoneWithCache(phoneNo);
if (user!=null){
return false;
......
......@@ -7,9 +7,9 @@ import cn.quantgroup.xyqb.entity.User;
*/
public interface IUserService {
User findByPhone(String phone);
User findByPhoneWithCache(String phone);
User findByUuid(String uuid);
User findByUuidWithCache(String uuid);
boolean register(String phoneNo, String password, Long registerFrom, String userIp);
......
......@@ -2,8 +2,6 @@ package cn.quantgroup.xyqb.service.user.impl;
import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.entity.User;
import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.repository.IUserDetailRepository;
import cn.quantgroup.xyqb.repository.IUserRepository;
import cn.quantgroup.xyqb.service.sms.ISmsService;
import cn.quantgroup.xyqb.service.user.ILkbUserService;
......@@ -39,7 +37,6 @@ public class UserServiceImpl implements IUserService {
private ISmsService smsService;
@Override
@Cacheable(value = "usercache", key = "'xyqbuser' + #phone", unless = "#result == null", cacheManager = "cacheManager")
public User findByPhoneInDb(String phone) {
return userRepository.findByPhoneNo(phone);
}
......@@ -79,13 +76,13 @@ public class UserServiceImpl implements IUserService {
@Override
@Cacheable(value = "usercache", key = "'xyqbuser' + #phone", unless = "#result == null", cacheManager = "cacheManager")
public User findByPhone(String phone) {
public User findByPhoneWithCache(String phone) {
return userRepository.findByPhoneNo(phone);
}
@Override
@Cacheable(value = "usercache", key = "'xyqbuser' + #uuid", unless = "#result == null", cacheManager = "cacheManager")
public User findByUuid(String uuid) {
public User findByUuidWithCache(String uuid) {
return userRepository.findByUuid(uuid);
}
......
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