| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.SysPermissionService; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 登录方法 |
| | | * |
| | | * @param loginBody 单点登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/SSOLogin") |
| | | public AjaxResult SSOLogin(@RequestBody LoginBody loginBody) { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | if (StringUtils.isEmpty(loginBody.getUsername()) || StringUtils.isEmpty(loginBody.getOrgid())) { |
| | | return AjaxResult.error("用户名或组织机构不能为空"); |
| | | } |
| | | |
| | | String token = loginService.loginByUserName(loginBody.getUsername() + "&" + loginBody.getOrgid()); |
| | | ajax.put(Constants.TOKEN, token); |
| | | return ajax; |
| | | } |
| | | |
| | | @GetMapping("/getToken") |
| | | public void getToken(HttpServletResponse response) throws IOException { |
| | | // 生成或获取token |