| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.UserLoginInfo; |
| | | import com.whyc.mapper.MenuMapper; |
| | | import com.whyc.mapper.RoleMenuMapper; |
| | | import com.whyc.mapper.UserMapper; |
| | | import com.whyc.pojo.Menu; |
| | |
| | | import com.whyc.util.DigestsUtil; |
| | | import com.whyc.util.ShiroUtil; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authc.DisabledAccountException; |
| | | import org.apache.shiro.authc.IncorrectCredentialsException; |
| | | import org.apache.shiro.authc.UnknownAccountException; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | |
| | | return new Response<>().set(0,false,"账号不存在"); |
| | | }catch (IncorrectCredentialsException e) { |
| | | return new Response<>().set(0,false,"密码错误"); |
| | | }catch (DisabledAccountException e){ |
| | | return new Response<>().set(0,false,"冻结用户"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new Response<>().set(0,false,"其他异常"); |
| | |
| | | info.setUsername(userName); |
| | | info.setTimestamp(System.currentTimeMillis()); |
| | | info.setUser(user); |
| | | info.setMenus(menus); |
| | | if ("superuser".equals(user.getName())){ |
| | | List<Menu> menuList = roleMenuMapper.getSuperUserMenu(); |
| | | info.setMenus(menuList); |
| | | }else{ |
| | | info.setMenus(menus); |
| | | } |
| | | return new Response<>().set(1,info); |
| | | } |
| | | return new Response<>().set(0,false); |