更新test
This commit is contained in:
parent
1c7e39a50f
commit
561002bac3
2
pom.xml
2
pom.xml
|
@ -20,7 +20,7 @@
|
|||
</parent>
|
||||
|
||||
<properties>
|
||||
<yexuejc.base.version>1.2.2</yexuejc.base.version>
|
||||
<yexuejc.base.version>1.2.4</yexuejc.base.version>
|
||||
<repos.yexuejc.url>https://nexus.yexuejc.club/repository/</repos.yexuejc.url>
|
||||
|
||||
<repos.aliyun.url>http://maven.aliyun.com/nexus/content/groups/public</repos.aliyun.url>
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.yexuejc.springboot.base.security.inte.UserService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -43,16 +44,25 @@ public class UserServiceImpl implements UserService {
|
|||
|
||||
/**
|
||||
* 根据用户名到数据库查询用户
|
||||
* <p>
|
||||
* 账号未找到,抛出UsernameNotFoundException异常=>会走第三方登录流程
|
||||
* </p>
|
||||
*
|
||||
* @param username 登录账号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public User getConsumerByUserName(String username) {
|
||||
if (StrUtil.isEmpty(username)) {
|
||||
throw new UsernameNotFoundException(username);
|
||||
}
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("mobile", username);
|
||||
Consumer consumer = consumerMapper.selectOne(queryWrapper);
|
||||
ArrayList roles = new ArrayList<>();
|
||||
if (null == consumer) {
|
||||
throw new UsernameNotFoundException(username);
|
||||
}
|
||||
ArrayList roles = new ArrayList<>();
|
||||
roles.add("ROLE_CONSUMER");
|
||||
consumer.setRoles(roles);
|
||||
return consumer;
|
||||
|
|
Loading…
Reference in New Issue