| | |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import com.hxzkoa.json.tb_achor; |
| | | import com.hxzkoa.json.tb_login; |
| | | import com.hxzkoa.json.tb_system; |
| | | import com.hxzkoa.json.tb_user; |
| | | import com.hxzkoa.services.LoginService; |
| | |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.HttpUtil; |
| | | import com.hxzkoa.util.ModifyConfig; |
| | | import com.hxzkoa.util.PageUtil; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | |
| | | String result = "0"; |
| | | String db_password = user.getPassword(); |
| | | if (password.equals(db_password)) { |
| | | // if (true) { |
| | | HttpSession session = request.getSession(); |
| | | ServletContext application = session.getServletContext(); |
| | | application.setAttribute("username", user.getUsername()); |
| | |
| | | application.setAttribute("deleteq", user.getDeleteq()); |
| | | application.setAttribute("alertq", user.getAlertq()); |
| | | application.setAttribute("deleteall", user.getDeleteall()); |
| | | application.setAttribute("fenceq", user.getFenceq()); |
| | | session.setAttribute("username", user.getUsername()); |
| | | session.setAttribute("password", user.getPassword()); |
| | | session.setAttribute("superuser", user.getSuperuser()); |
| | |
| | | application.removeAttribute("deleteq"); |
| | | application.removeAttribute("alertq"); |
| | | application.removeAttribute("deleteall"); |
| | | application.removeAttribute("fenceq"); |
| | | session.removeAttribute("username"); |
| | | session.removeAttribute("password"); |
| | | session.removeAttribute("superuser"); |
| | | session.removeAttribute("deleteq"); |
| | | session.removeAttribute("alertq"); |
| | | session.removeAttribute("deleteall"); |
| | | session.removeAttribute("fenceq"); |
| | | |
| | | // 停止报文接收 |
| | | if (Config.getUdpRunning().equals("1")) { |
| | |
| | | } |
| | | return "redirect:/hxzk/login.jsp"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/loginfa.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String loginfa(HttpServletRequest request) throws Exception { |
| | | String toPage = "forward:/hxzk/sysSetting/loginfa.jsp"; |
| | | List<tb_login> logins = loginService.getloginManagement(1); |
| | | int curPage = 1; |
| | | int count = loginService.getloginManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | request.setAttribute("dataList", logins); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "findloginid.do", method = {RequestMethod.POST,RequestMethod.GET}) |
| | | public JSONObject findloginid(HttpServletRequest request) throws Exception { |
| | | JSONObject json = new JSONObject(); |
| | | String username = request.getParameter("input"); |
| | | List<tb_login> logins = loginService.getloginid(username); |
| | | json.put("dataList", logins); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/loginManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String loginManagement_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = loginService.getloginManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | | if ("pre".equals(pageStr)) { |
| | | if (curPage > 1) { |
| | | page = curPage - 1; |
| | | } |
| | | } else if ("next".equals(pageStr)) { |
| | | if (curPage < minPage) { |
| | | page = curPage + 1; |
| | | } |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_login> loginManagementList = loginService.getloginManagement(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", loginManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", page); |
| | | return json.toString(); |
| | | } |
| | | } |