@RequestMapping(method = RequestMethod.POST, value = "/addCrew") public ModelAndView addCrew(final HttpServletRequest request) { String crewName = request.getParameter("crewName"); String contactNumber = request.getParameter("crewPhone"); String address = request.getParameter("crewAddress"); String salary = request.getParameter("salary"); String userId = request.getParameter("crewUserId"); String password = request.getParameter("crewPassword"); String partyCrew = request.getParameter("partyCrew"); String areaId = request.getParameter("masterAreaCrew"); AreaVo area = null; if (areaId != null) { area = new AreaVo(); area.setDeliveryAreaId(new Long(areaId)); } Long salaryLong = new Long(0); if (salary != null && salary.equals("")) { salaryLong = new Long(salary); } Crew crewInfo = new Crew(); crewInfo.setAddress(address); crewInfo.setContactnumber(contactNumber); crewInfo.setName(crewName); crewInfo.setPassword(password); if (null != partyCrew && partyCrew.equals("true")) { crewInfo.setParty(true); } if (salary != null && !salary.equals("")) { crewInfo.setSalary(new Long(salary)); } crewInfo.setUserId(userId); crewService.addCrew(crewInfo, area); return null; }
@RequestMapping(method = RequestMethod.POST, value = "/updateCrew") public ModelAndView updateCrew( final HttpServletRequest request, @RequestParam(value = "crewId") String crewId) { String address = request.getParameter("crewAddress"); String salary = request.getParameter("salary"); String crewName = request.getParameter("crewName"); String contactNumber = request.getParameter("contactNumber"); String areaId = request.getParameter("areaId"); Long salaryLong = new Long(0); AreaVo area = new AreaVo(); if (areaId != null && areaId.equals("")) { area.setDeliveryAreaId(new Long(areaId)); } if (salary != null && salary.equals("")) { salaryLong = new Long(salary); } crewService.updateCrew(crewId, crewName, contactNumber, address, salaryLong, area); return null; }