@RequestMapping(value = "/searchuseraudit", method = RequestMethod.GET) public ModelAndView searchUserAudit(HttpServletRequest request, ModelMap modelmap) { ModelAndView model = new ModelAndView(); try { String uname = request.getParameter("uname"); String fdate = request.getParameter("fdate"); String tdate = request.getParameter("tdate"); String[] fdateval = fdate.split("/"); String fmonth = fdateval[0]; String fday = fdateval[1]; String fyear = fdateval[2]; String firstdate = fyear + "/" + fmonth + "/" + fday + " 00:00:00"; String[] tdateval = tdate.split("/"); String tmonth = tdateval[0]; String tday = tdateval[1]; String tyear = tdateval[2]; String lastdate = tyear + "/" + tmonth + "/" + tday + " 23:59:59"; List<AuditTrial> useraudit = uamService.searchUserAudit(uname, firstdate, lastdate); System.out.println("useraudit==>" + useraudit.size()); modelmap.addAttribute("useraudit", useraudit); } catch (Exception e) { e.printStackTrace(); } model.setViewName("uam/viewuseraudit"); return model; }
@RequestMapping(value = "/checkEmpId", method = RequestMethod.GET) public @ResponseBody String checkEmpId(HttpServletRequest request, ModelMap modelmap) { ModelAndView model = null; String messages = null; String status = null; try { String empid = request.getParameter("empid"); System.out.println("empid=>" + empid); List<UserRegistration> userlist = uamService.checkEmpId(empid); if (userlist != null) { status = "found"; } else { status = "notfound"; } System.out.println("status=>" + status); Gson gson = new Gson(); modelmap.addAttribute("status", status); messages = new Gson().toJson(modelmap); // model = new ModelAndView("fees/feessettingform"); } catch (Exception e) { e.printStackTrace(); } return messages; }
@RequestMapping(value = "/getEmailIdbyEmpId", method = RequestMethod.GET) public @ResponseBody String getEmailIdbyEmpId(HttpServletRequest request, ModelMap modelmap) { System.out.println("In getEmailIdbyEmpId"); String json = null; String messages = null; List<UserRegistration> userlist = new ArrayList<UserRegistration>(); try { String empid = request.getParameter("employeeId"); if (empid != null) { userlist = uamService.getEmailIdbyEmpId(empid); } Gson gson = new Gson(); System.out.println("userlist===>" + userlist); if (userlist != null) { modelmap.addAttribute("userlist", userlist); } else { modelmap.addAttribute("userlist", "null"); } messages = new Gson().toJson(userlist); } catch (Exception e) { e.printStackTrace(); } return messages; }
@RequestMapping(value = "/userdepartment", method = RequestMethod.GET) public ModelAndView userDepartment(HttpServletRequest request, ModelMap modelmap) { System.out.println("In auth userform method"); ModelAndView model = new ModelAndView(); try { List<BranchCode> branchcode = uamService.getBranchCode(); List<DepartmentDesignation> departcode = uamService.getDDvalue(); List<DepartmentDesignation> descode = uamService.getDDvalue(); modelmap.addAttribute("branchcode", branchcode); modelmap.addAttribute("departcode", departcode); modelmap.addAttribute("descode", descode); model.setViewName("acquirer/userdepartment"); } catch (Exception e) { e.printStackTrace(); } return model; }
@RequestMapping(value = "/useraudit", method = RequestMethod.GET) public ModelAndView userAudit(HttpServletRequest request, ModelMap modelmap) { ModelAndView model = new ModelAndView(); try { List<Admin> userlist = uamService.getAdminDetails(); System.out.println("userlist==>" + userlist.size()); modelmap.addAttribute("userlist", userlist); } catch (Exception e) { e.printStackTrace(); } model.setViewName("uam/useraudit"); return model; }
@RequestMapping(value = "/savepermission", method = RequestMethod.POST) public ModelAndView savePermission(HttpServletRequest request) { System.out.println("In auth userform method"); ModelAndView model = null; AssignRights ar = null; try { ar = new AssignRights(); model = new ModelAndView(); AuditTrial audit = new AuditTrial(); HttpSession sessionObj = request.getSession(); // String depid = request.getParameter("departmentId"); String depname = request.getParameter("department"); // String desid = request.getParameter("designationId"); String des = request.getParameter("designation"); String eid = request.getParameter("employeeId"); String usname = request.getParameter("userName"); String bcode = request.getParameter("branchcode"); String funname[] = request.getParameterValues("hiddenfun"); String fundes[] = request.getParameterValues("hiddendes"); for (int s = 0; s < funname.length; s++) { String read = request.getParameter("hiddenread" + s); String write = request.getParameter("hiddenwrite" + s); String del = request.getParameter("hiddendel" + s); ar.setDepartmentname(depname); ar.setDesignation(des); ar.setFunctions(funname[s]); ar.setFunctionsdes(fundes[s]); ar.setRead(read); ar.setWrite(write); ar.setDel(del); ar.setEmpid(eid); ar.setUsername(usname); ar.setBranchcode(bcode); int v = uamService.savePermission(ar); } // --insert audit start-- DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); // get current date time with Date() Date date = new Date(); System.out.println("date and time==>" + dateFormat.format(date)); String adminname = (String) sessionObj.getAttribute("adminname"); audit.setUsername(adminname); audit.setDescription("Insert the 'Designation & Department Registration'"); audit.setLogdate(dateFormat.format(date)); int auditid = merchantService.saveAudit(audit); // --insert audit end -- model.setViewName("acquirer/userdepartmentconfirm"); } catch (Exception e) { e.printStackTrace(); } return model; }
@RequestMapping(value = "/saveregistration", method = RequestMethod.POST) public ModelAndView saveRegistration(HttpServletRequest request) { ModelAndView model = null; UserRegistration ur = null; try { AuditTrial audit = new AuditTrial(); HttpSession sessionObj = request.getSession(); ur = new UserRegistration(); model = new ModelAndView(); String empid = request.getParameter("employeeId"); String username = request.getParameter("userName"); String branchcode = request.getParameter("branchcode"); String des = request.getParameter("designation"); String depart = request.getParameter("department"); String dob = request.getParameter("dob"); String email = request.getParameter("emailId"); String mobile = request.getParameter("mobile"); String tel = request.getParameter("tel"); String add = request.getParameter("address"); String count = request.getParameter("country"); Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int dateval = cal.get(Calendar.DATE); System.out.println("year=>" + year); System.out.println("month=>" + month); System.out.println("dateval=>" + dateval); Date curdate = new Date(dateval + "/" + month + "/" + year); Date date = new Date(dob); ur.setEmpid(empid); ur.setName(username); ur.setBranchcode(branchcode); ur.setDesignation(des); ur.setDepartment(depart); ur.setDob(date); ur.setEmailid(email); ur.setMobile(Long.parseLong(mobile)); ur.setTel(Long.parseLong(tel)); ur.setAddress(add); ur.setCountry(count); ur.setCurrentdate(curdate); String randomPwd = generateRandomString(); String encryptedPwd = encrypt(randomPwd); System.out.println("merchantId==>" + encryptedPwd); ur.setPassword(encryptedPwd); // ur.setPassword("password"); int v = uamService.saveRegistration(ur); sendEmailConfirmation(username, encryptedPwd, request, empid, email); // --audit start-- DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); // get current date time with Date() Date date1 = new Date(); System.out.println("date and time==>" + dateFormat.format(date1)); String adminname = (String) sessionObj.getAttribute("adminname"); audit.setUsername(adminname); audit.setDescription("Insert the user '" + username + "'"); audit.setLogdate(dateFormat.format(date1)); int auditid = merchantService.saveAudit(audit); // --audit end-- model.setViewName("acquirer/userregistrationconfirm"); } catch (Exception e) { e.printStackTrace(); } return model; }