diff --git a/src/main/java/cn/wizzer/modules/back/sys/controllers/LoginController.java b/src/main/java/cn/wizzer/modules/back/sys/controllers/LoginController.java index 7d8f67654..452921532 100644 --- a/src/main/java/cn/wizzer/modules/back/sys/controllers/LoginController.java +++ b/src/main/java/cn/wizzer/modules/back/sys/controllers/LoginController.java @@ -6,9 +6,7 @@ import cn.wizzer.common.shiro.exception.EmptyCaptchaException; import cn.wizzer.common.shiro.exception.IncorrectCaptchaException; import cn.wizzer.common.shiro.filter.AuthenticationFilter; -import cn.wizzer.common.util.StringUtil; import cn.wizzer.modules.back.sys.models.Sys_log; -import cn.wizzer.modules.back.sys.models.Sys_menu; import cn.wizzer.modules.back.sys.models.Sys_user; import cn.wizzer.modules.back.sys.services.MenuService; import cn.wizzer.modules.back.sys.services.UserService; @@ -34,10 +32,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * Created by wizzer on 2016/6/22. @@ -50,8 +44,6 @@ public class LoginController { @Inject UserService userService; @Inject - MenuService menuService; - @Inject SysLogService sysLogService; @At("") @@ -141,27 +133,7 @@ public Object doLogin(@Attr("loginToken") AuthenticationToken token, HttpServlet ThreadContext.bind(subject); subject.login(token); Sys_user user = (Sys_user) subject.getPrincipal(); - //获取用户菜单 - user.setMenus(userService.getMenus(user.getId())); - user.setLoginIp(StringUtil.getRemoteAddr()); - //计算左侧菜单 - List firstMenus = new ArrayList<>(); - Map> secondMenus = new HashMap<>(); - for (Sys_menu menu : user.getMenus()) { - if (menu.getPath().length() > 4) { - List s = secondMenus.get(StringUtil.getParentId(menu.getPath())); - if (s == null) s = new ArrayList<>(); - s.add(menu); - secondMenus.put(StringUtil.getParentId(menu.getPath()), s); - } else if (menu.getPath().length() == 4) { - firstMenus.add(menu); - } - } - user.setFirstMenus(firstMenus); - user.setSecondMenus(secondMenus); - if (!Strings.isBlank(user.getCustomMenu())) { - user.setCustomMenus(menuService.query(Cnd.where("id", "in", user.getCustomMenu().split(",")))); - } + int count = user.getLoginCount() == null ? 0 : user.getLoginCount(); sysLogService.async(Sys_log.c("info", "用户登陆", "成功登录系统!", null)); userService.update(Chain.make("loginIp", user.getLoginIp()).add("loginAt", (int) (System.currentTimeMillis() / 1000))