|  | @@ -1,13 +1,16 @@
 | 
	
		
			
				|  |  |  package com.bootdo.system.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.net.URLEncoder;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.HashMap;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Map;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.bootdo.common.domain.DictDO;
 | 
	
		
			
				|  |  | +import com.bootdo.common.token.TokenUtil;
 | 
	
		
			
				|  |  |  import com.bootdo.common.utils.*;
 | 
	
		
			
				|  |  |  import org.apache.shiro.authz.annotation.RequiresPermissions;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
	
		
			
				|  | @@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  |  import org.springframework.ui.Model;
 | 
	
		
			
				|  |  | +import org.springframework.util.ObjectUtils;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -44,7 +48,8 @@ public class UserController extends BaseController {
 | 
	
		
			
				|  |  |      RoleService roleService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      DictService dictService;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private TokenUtil tokenUtil;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value("${sysProvince:#{null}}")
 | 
	
		
			
				|  |  |      public String sysProvince;
 | 
	
	
		
			
				|  | @@ -52,6 +57,9 @@ public class UserController extends BaseController {
 | 
	
		
			
				|  |  |      @Value("${sysCity:#{null}}")
 | 
	
		
			
				|  |  |      public String sysCity;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Value("${back_manange_sso_url:#{null}}")
 | 
	
		
			
				|  |  | +    public String backManangeSsoUrl;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Log("访问用户管理")
 | 
	
		
			
				|  |  |      @RequiresPermissions("sys:user:user")
 | 
	
		
			
				|  |  |      @GetMapping("")
 | 
	
	
		
			
				|  | @@ -320,4 +328,56 @@ public class UserController extends BaseController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ResponseBody
 | 
	
		
			
				|  |  | +    @GetMapping("/hasBackManangePerm")
 | 
	
		
			
				|  |  | +    public boolean hasBackManangePerm() {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            //获取当前登录账号信息
 | 
	
		
			
				|  |  | +            UserDO currUser = ShiroUtils.getUser();
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty(currUser)) {
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            List<Integer> list = userService.getCurrUserSysList(currUser.getUserId());
 | 
	
		
			
				|  |  | +            if(!ObjectUtils.isEmpty(list) && list.contains(0)){
 | 
	
		
			
				|  |  | +                return true;
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        } catch (Exception e){
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping("/getBackManangeSSoUrl")
 | 
	
		
			
				|  |  | +    public String getBackManangeSSoUrl() {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            //获取当前登录账号信息
 | 
	
		
			
				|  |  | +            UserDO currUser = ShiroUtils.getUser();
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty(currUser)) {
 | 
	
		
			
				|  |  | +                return null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            List<Integer> list = userService.getCurrUserSysList(currUser.getUserId());
 | 
	
		
			
				|  |  | +            if(ObjectUtils.isEmpty(list) || !list.contains(0)){
 | 
	
		
			
				|  |  | +                return null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String cacheToken = tokenUtil.getLoginUser(currUser.getUsername());
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty(cacheToken)) {
 | 
	
		
			
				|  |  | +                return null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            String tokenStr = cacheToken.split("_")[0];
 | 
	
		
			
				|  |  | +            return "redirect:" + backManangeSsoUrl + "?token=" + URLEncoder.encode(tokenStr);
 | 
	
		
			
				|  |  | +        } catch (Exception e){
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +            return null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |