|
@@ -19,6 +19,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -43,7 +44,6 @@ public class UserServiceImpl implements UserDetailsService {
|
|
|
}
|
|
|
if ("admin".equals(request.getParameter("loginFrom"))) {
|
|
|
redisTemplate.opsForValue().set(username+"_info", JSON.toJSONString(tenant));
|
|
|
-
|
|
|
}else {
|
|
|
String code = request.getParameter("password");
|
|
|
if (StringUtils.isBlank(code)) {
|
|
@@ -55,17 +55,14 @@ public class UserServiceImpl implements UserDetailsService {
|
|
|
}
|
|
|
if (code.equals(object.toString())){
|
|
|
redisTemplate.opsForValue().set(username+"_info", JSON.toJSONString(tenant));
|
|
|
-
|
|
|
- return new User(tenant.getTenantPhone(),code,new ArrayList<>() );
|
|
|
+ }else{
|
|
|
+ throw new UsernameNotFoundException("验证码错误");
|
|
|
}
|
|
|
- throw new UsernameNotFoundException("验证码错误");
|
|
|
}
|
|
|
-
|
|
|
List<SysRole> roleList = sysRoleService.getRoleListByUserId(tenant.getId());
|
|
|
Set<String> collect = roleList.stream().map(SysRole::getName).collect(Collectors.toSet());
|
|
|
String[] arr = new String[collect.size()];
|
|
|
String[] array = collect.toArray(arr);
|
|
|
return User.builder().username(tenant.getTenantPhone()).password(tenant.getPassword()).roles(array).build();
|
|
|
-
|
|
|
}
|
|
|
}
|