|
|
@@ -7,9 +7,9 @@ import com.usoftchina.bi.core.base.RoleConstant;
|
|
|
import com.usoftchina.bi.core.exception.MyException;
|
|
|
import com.usoftchina.bi.core.jdbc.DynamicDataSourceContextHolder;
|
|
|
import com.usoftchina.bi.core.utils.EncryUtil;
|
|
|
+import com.usoftchina.bi.core.utils.GetTokenDataUtil;
|
|
|
import com.usoftchina.bi.server.aspect.JwtTokenAspect;
|
|
|
import com.usoftchina.bi.server.dao.user.UserMapper;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.usoftchina.bi.server.model.po.MessageLog;
|
|
|
import com.usoftchina.bi.server.model.po.TokenData;
|
|
|
import com.usoftchina.bi.server.model.po.User;
|
|
|
@@ -24,10 +24,10 @@ import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@@ -160,9 +160,11 @@ public class UserService {
|
|
|
查询用户列表
|
|
|
*/
|
|
|
@Cacheable(value = "userList")
|
|
|
- public RepEntity getUserList(){
|
|
|
+ public RepEntity getUserList(String token){
|
|
|
+ Map<String, String> resultMap = GetTokenDataUtil.getTokenData(token);
|
|
|
+ String role = resultMap.get("role");
|
|
|
List<User> userList = new ArrayList<>();
|
|
|
- if (RoleConstant.SUPER_ADMIN.getRole().equals(BaseContextHolder.getRole())){
|
|
|
+ if (RoleConstant.SUPER_ADMIN.getRole().equals(role)){
|
|
|
userList = userMapper.getUserList();
|
|
|
}
|
|
|
return new RepEntity(RepCode.success, userList);
|
|
|
@@ -212,9 +214,11 @@ public class UserService {
|
|
|
/*
|
|
|
查询用户组
|
|
|
*/
|
|
|
- public RepEntity getUserGroup(){
|
|
|
+ public RepEntity getUserGroup(String token){
|
|
|
+ Map<String, String> resultMap = GetTokenDataUtil.getTokenData(token);
|
|
|
+ String role = resultMap.get("role");
|
|
|
List<UserGroup> userGroup= new ArrayList<>();
|
|
|
- if (RoleConstant.SUPER_ADMIN.getRole().equals(BaseContextHolder.getRole())) {
|
|
|
+ if (RoleConstant.SUPER_ADMIN.getRole().equals(role)) {
|
|
|
userGroup= userMapper.getUserGroupList();
|
|
|
}
|
|
|
return new RepEntity(RepCode.success, userGroup);
|