@RequestMapping(value = "/saveAddressDetails", method = RequestMethod.POST) public @ResponseBody String saveAddressDetails( HttpSession session, HttpServletRequest request, @RequestBody String addressDetailsJson) { /**/ AddressDetailsHelper addressDetailsHelper = new AddressDetailsHelper(); HashMap<Object, Object> map = new HashMap<Object, Object>(); try { List<AddressDetails> addressDetails = new ArrayList<AddressDetails>(); UserDetail userDetails = (UserDetail) session.getAttribute("selectedUser"); addressDetails = addressDetailsHelper.getAddressDetailFromJson(addressDetailsJson, userDetails, "save"); DomainDetail domainDetailsBean = userDetails.getDomainDetail(); String status = addressDetailsService.saveUpdateAddressDetails( addressDetails, userDetails, domainDetailsBean); if (null == status) { map.put("ajaxResult", "success"); } } catch (Exception e) { e.printStackTrace(); util.sendExceptionEmail(e); map = util.responseBuilder(e.getMessage()); } return util.getJsonResult(map); }
@Override public CustomerDirectory saveOrUpdateCustomer( CustomerDirectory customerListForm, UserDetail userDetails) throws Exception { DomainDetail domainDetailsBean = userDetails.getDomainDetail(); CustomerDirectory customer = null; customerListForm.setDomainDetail(domainDetailsBean); customerListForm.setStatus("ACTIVE"); if (customerListForm.getCompanyId() == null) { customerListForm.setSubmittedDate(new Date()); customerListForm.setSubmittedBy(userDetails); customer = customerDetailsDAO.saveCustomer(customerListForm); } else { customerListForm.setUpdatedDate(new Date()); customerListForm.setUpdatedBy(userDetails); customer = customerDetailsDAO.saveCustomer(customerListForm); } return customer; }