JAVAJSP人力资源管理系统(JSP企业人事管理系统)JSP企业人事考勤系统JSP人事管理系统

JAVAJSP人力资源管理系统(JSP企业人事管理系统)JSP企业人事考勤系统JSP人事管理系统

  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {         JSONObject jsonObject = new JSONObject();         String username = req.getParameter("username");         String password = req.getParameter("password");         resp.setCharacterEncoding("UTF-8");           HttpSession session = req.getSession();         if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {             jsonObject.put("code", 2000);             jsonObject.put("flag", "fail");             jsonObject.put("user", null);             jsonObject.put("msg", "usernameOrPasswordIsBank");//用户名密码不能为空             resp.getWriter().print(jsonObject);             return;         }         password = MyMD5Util.encrypt(password);         System.out.println(password);         BusinessUserVO businessUserVO = new BusinessUserVO();         businessUserVO.setUsername(username);         businessUserVO.setPassword(password);         StudentUserVO studentUserVO = new StudentUserVO();         studentUserVO.setUsername(username);         studentUserVO.setPassword(password);           String flag1 = null;         String flag2 = null;         try {             flag1 = BusinessUserDao.selectUsername(businessUserVO);             if ("ok".equals(flag1)) {//企业用户名存在                 BusinessUserDTO businessUserDTO = BusinessUserDao.select(businessUserVO);                 if (businessUserDTO != null) {                     jsonObject.put("code", 2000);                     jsonObject.put("flag", "success");//登录成功                     jsonObject.put("user", businessUserDTO);                     jsonObject.put("msg", "login_success");                     session.setAttribute("businessUser",businessUserDTO);                     resp.getWriter().print(jsonObject);                     return;                 } else {                     jsonObject.put("code", 2000);                     jsonObject.put("flag", "fail");//登录失败                     jsonObject.put("user", null);                     jsonObject.put("msg", "passwordError");//密码错误                     resp.getWriter().print(jsonObject);                     return;                 }             }             flag2 = StudentUserDao.selectUsername(studentUserVO);             if ("ok".equals(flag2)) {//学生用户名存在                 StudentUser studentUser = StudentUserDao.select(studentUserVO);                 if (studentUser != null) {                     jsonObject.put("code", 2000);                     jsonObject.put("flag", "success");//登录成功                     jsonObject.put("user", studentUser);                     jsonObject.put("msg", "login_success");                     session.setAttribute("studentUser",studentUser);                     resp.getWriter().print(jsonObject);                     return;                 } else {                     jsonObject.put("code", 2000);                     jsonObject.put("flag", "fail");//登录失败                     jsonObject.put("user", null);                     jsonObject.put("msg", "passwordError");//密码错误                     resp.getWriter().print(jsonObject);                     return;                 }               }             //用户名不存在,前往注册             jsonObject.put("code", 2000);             jsonObject.put("flag", "fail");//登录失败             jsonObject.put("user", null);             jsonObject.put("msg", "usernameIsNotExist");//密码错误             resp.getWriter().print(jsonObject);             return;           } catch (SQLException throwables) {             throwables.printStackTrace();         }         return;       }       @Override     protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {         doGet(req, resp);     }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值