Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/updateMemberCustomer",method = RequestMethod.POST )
- @PreAuthorize("hasAnyRole('" + Roles.ROLE_OPERATION_STAFF + "','" + Roles.ROLE_ADMIN + "', '" + Roles.ROLE_CLT + "', '" + Roles.ROLE_FINANCE + "', '" + Roles.ROLE_LEGALCOMPLIANCE + "', '" + Roles.ROLE_RISKFRAUD + "', '" + Roles.ROLE_SALESUPPORT + "')")
- public String updateMemberCustomer(HttpServletRequest servletRequest, HttpServletResponse servletResponse, ModelMap model) throws Exception {
- if (!checkLogin(servletRequest, servletResponse))
- return REDIRECT_LOGIN;
- HttpSession httpSession = servletRequest.getSession(true);
- Long userId = (Long)httpSession.getAttribute("user_id");
- String phoneNumber = servletRequest.getParameter("phone");
- log.info("Start updateMemberCustomer for {} id {}", phoneNumber, userId);
- String id = servletRequest.getParameter("accountId");
- String imageUrlValue = servletRequest.getParameter("imageUrlValue");
- String imageUrlValue1 = servletRequest.getParameter("imageUrlValue1");
- String imageUrlValue2 = servletRequest.getParameter("imageUrlValue2");
- String imageUrlValue3 = servletRequest.getParameter("imageUrlValue3");
- String emailUpdate = servletRequest.getParameter("emailUpdate");
- if(StringUtils.isEmpty(emailUpdate)) {
- emailUpdate = null;
- }
- String genderUpdate = servletRequest.getParameter("genderUpdate");
- String currentCityUpdate = servletRequest.getParameter("currentCityUpdate");
- String currentDistrictUpdate = servletRequest.getParameter("currentDistrictUpdate");
- String currentAddressUpdate = servletRequest.getParameter("currentAddressUpdate");
- String permanentCityUpdate = servletRequest.getParameter("permanentCityUpdate");
- String permanentDistrictUpdate = servletRequest.getParameter("permanentDistrictUpdate");
- String permanentAddressUpdate = servletRequest.getParameter("permanentAddressUpdate");
- String occupationUpdate = servletRequest.getParameter("occupationUpdate");
- String positionUpdate = servletRequest.getParameter("positionUpdate");
- String nationalityUpdate = servletRequest.getParameter("nationalityUpdate");
- String identitytypeUpdate = servletRequest.getParameter("identitytypeUpdate");
- String nationalIdUpdate = servletRequest.getParameter("nationalIdUpdate");
- String dateIssuanceUpdate = servletRequest.getParameter("dateIssuanceUpdate");
- String placeResidenceUpdate = servletRequest.getParameter("placeResidenceUpdate");
- String fileImageMessageValidate = servletRequest.getParameter("fileImageMessageValidate");
- String fileImageMessageValidate1 = servletRequest.getParameter("fileImageMessageValidate1");
- String fileImageMessageValidate2 = servletRequest.getParameter("fileImageMessageValidate2");
- String fileImageMessageValidate3 = servletRequest.getParameter("fileImageMessageValidate3");
- String bankIdInfoUpdate = servletRequest.getParameter("bankIdInfoUpdate");
- String bankNameUpdate = servletRequest.getParameter("bankNameUpdate");
- String bankAccountNumberUpdate = servletRequest.getParameter("bankAccountNumberUpdate");
- String accountNameUpdate = servletRequest.getParameter("accountNameUpdate");
- String firstNameUpdate = servletRequest.getParameter("firstNameUpdate");
- String middleNameUpdate = servletRequest.getParameter("middleNameUpdate");
- String lastNameUpdate = servletRequest.getParameter("lastNameUpdate");
- String lastDateOfBirth = servletRequest.getParameter(DATE_OF_BIRTH);
- String kycType = servletRequest.getParameter("kycType");
- Date dateNow = new Date();
- Date dateIssuance = null;
- Date dateOfB = null;
- DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
- if(!StringUtils.isEmpty(dateIssuanceUpdate)) {
- dateIssuance = dateFormat.parse(dateIssuanceUpdate);
- }
- if(!StringUtils.isEmpty(lastDateOfBirth)){
- dateOfB = dateFormat.parse(lastDateOfBirth);
- }
- Pattern pattern = Pattern.compile("[!@#$%&+=|<>?{}\\[\\]~]");
- Matcher matchercurrent = pattern.matcher(currentAddressUpdate);
- Matcher matcherpermanent = pattern.matcher(permanentAddressUpdate);
- if(!StringUtils.isEmpty(emailUpdate) && Utils.validateEmail(emailUpdate) == false) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.emailvalid");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(!StringUtils.isEmpty(fileImageMessageValidate)) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service") + fileImageMessageValidate;
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(!StringUtils.isEmpty(fileImageMessageValidate1)) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service") + fileImageMessageValidate1;
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(!StringUtils.isEmpty(fileImageMessageValidate2)) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + fileImageMessageValidate2;
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(!StringUtils.isEmpty(fileImageMessageValidate3)) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + fileImageMessageValidate3;
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if((dateIssuance!= null && dateIssuance.after(dateNow)) ||
- (dateOfB != null && dateOfB.after(dateNow) && Utils.validateDateOfBirth(lastDateOfBirth, 15))) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.dateissuance");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(matchercurrent.find()) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.matchercurren");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- }else {
- if(matcherpermanent.find()) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.matcherpermanent");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- if(!StringUtils.isEmpty(identitytypeUpdate) && identitytypeUpdate.equals(profileIdentityNational) && !StringUtils.isEmpty(nationalIdUpdate) && (nationalIdUpdate.length() != lengthNational1 && nationalIdUpdate.length() != lengthNational2)) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.lengthNational");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- }else {
- if(!StringUtils.isEmpty(identitytypeUpdate) && identitytypeUpdate.equals(profileIdentityPassport) && !StringUtils.isEmpty(nationalIdUpdate) && nationalIdUpdate.length() != lengthPassport) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.lengthPassport");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- }else {
- if(!StringUtils.isEmpty(bankAccountNumberUpdate) && (bankAccountNumberUpdate.length() < 9 || bankAccountNumberUpdate.length() > 20 ) ) {
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + notify("vnwallet.list.detail.message.error.lengthbankAccountNumber");
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- } else {
- CardPictures imageLink = new CardPictures();
- Part filePart = null;
- CardPictures imageLink1 = new CardPictures();
- Part filePart1 = null;
- CardPictures imageLink2 = new CardPictures();
- Part filePart2 = null;
- CardPictures imageLink3 = new CardPictures();
- Part filePart3 = null;
- try {
- filePart = servletRequest.getPart("fileImage");
- imageLink = uploadToAWS(userId, filePart);
- } catch (Exception e){
- model.put(messageUpdateString, "error");
- log.error(e.getMessage(), e);
- String error = notify("vnwallet.offer.detail.message.error.filepart")
- + e.getMessage();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- }
- try {
- filePart1 = servletRequest.getPart("fileImage1");
- imageLink1 = uploadToAWS(userId, filePart1);
- } catch (Exception e){
- model.put(messageUpdateString, "error");
- log.error(e.getMessage(), e);
- String error = notify("vnwallet.offer.detail.message.error.filepart")
- + e.getMessage();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- }
- try {
- filePart2 = servletRequest.getPart("fileImage2");
- imageLink2 = uploadToAWS(userId, filePart2);
- } catch (Exception e){
- model.put(messageUpdateString, "error");
- log.error(e.getMessage(), e);
- String error = notify("vnwallet.offer.detail.message.error.filepart")
- + e.getMessage();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- }
- try {
- filePart3 = servletRequest.getPart("fileImage3");
- imageLink3 = uploadToAWS(userId, filePart3);
- } catch (Exception e){
- model.put(messageUpdateString, "error");
- log.error(e.getMessage(), e);
- String error = notify("vnwallet.offer.detail.message.error.filepart")
- + e.getMessage();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- }
- List<CardPictures> cardPicturesList = new ArrayList<CardPictures>();
- CardPictures cardPictures = new CardPictures();
- CardPictures cardPictures1 = new CardPictures();
- CardPictures cardPictures2 = new CardPictures();
- CardPictures cardPictures3 = new CardPictures();
- String[] imageUrlValues = null;
- String[] imageUrlValues1 = null;
- String[] imageUrlValues2 = null;
- String[] imageUrlValues3 = null;
- BankInfo bankInfo = new BankInfo();
- if(!StringUtils.isEmpty(imageUrlValue)) {
- imageUrlValues = imageUrlValue.split("file_name=");
- }
- if(!StringUtils.isEmpty(imageUrlValue1)) {
- imageUrlValues1 = imageUrlValue1.split("file_name=");
- }
- if(!StringUtils.isEmpty(imageUrlValue2)) {
- imageUrlValues2 = imageUrlValue2.split("file_name=");
- }
- if(!StringUtils.isEmpty(imageUrlValue3)) {
- imageUrlValues3 = imageUrlValue3.split("file_name=");
- }
- if(imageLink == null || (imageLink != null && StringUtils.isEmpty(imageLink.getPath()))) {
- if(imageUrlValues != null) {
- cardPictures.setName(imageUrlValues[1]);
- cardPictures.setPath(imageUrlValue);
- }
- } else{
- cardPictures = imageLink;
- }
- if(imageLink1 == null || (imageLink1 != null && StringUtils.isEmpty(imageLink1.getPath()))) {
- if(imageUrlValues1 != null) {
- cardPictures1.setName(imageUrlValues1[1]);
- cardPictures1.setPath(imageUrlValue1);
- }
- } else {
- cardPictures1 = imageLink1;
- }
- if(imageLink2 == null || (imageLink2 != null && StringUtils.isEmpty(imageLink2.getPath()))) {
- if(imageUrlValues2 != null) {
- cardPictures2.setName(imageUrlValues2[1]);
- cardPictures2.setPath(imageUrlValue2);
- }
- } else {
- cardPictures2 = imageLink2;
- }
- if(imageLink3 == null || (imageLink3 != null && StringUtils.isEmpty(imageLink3.getPath()))) {
- if(imageUrlValues3 != null) {
- cardPictures3.setName(imageUrlValues3[1]);
- cardPictures3.setPath(imageUrlValue3);
- }
- } else {
- cardPictures3 = imageLink3;
- }
- cardPictures2.setType(AttachmentType.ScannedSelfie.code);
- cardPictures3.setType(AttachmentType.ScannedBankCard.code);
- if(!StringUtils.isEmpty(identitytypeUpdate)) {
- if(Integer.valueOf(identitytypeUpdate).equals(IdentityType.IdentityCard.code)) {
- cardPictures.setType(AttachmentType.ScannerdIdentityCard.code);
- cardPictures1.setType(AttachmentType.ScannerdIdentityCard.code);
- }
- if(Integer.valueOf(identitytypeUpdate).equals(IdentityType.Passport.code)) {
- cardPictures.setType(AttachmentType.ScannedPassport.code);
- cardPictures1.setType(AttachmentType.ScannedPassport.code);
- }
- }
- if(cardPictures != null && !StringUtils.isEmpty(cardPictures.getPath())) {
- cardPicturesList.add(cardPictures);
- }
- if(cardPictures1 != null && !StringUtils.isEmpty(cardPictures1.getPath())) {
- cardPicturesList.add(cardPictures1);
- }
- if(cardPictures2 != null && !StringUtils.isEmpty(cardPictures2.getPath())) {
- cardPicturesList.add(cardPictures2);
- }
- if(cardPictures3 != null && !StringUtils.isEmpty(cardPictures3.getPath())) {
- cardPicturesList.add(cardPictures3);
- }
- UpdateMemberCustomerRequest request= new UpdateMemberCustomerRequest();
- if(!StringUtils.isEmpty(id)) {
- request.setId(Long.valueOf(id));
- }
- if(StringUtils.isEmpty(bankIdInfoUpdate) && StringUtils.isEmpty(bankNameUpdate)) {
- bankInfo = null;
- } else {
- if(!StringUtils.isEmpty(bankIdInfoUpdate)) {
- bankInfo.setBankIdInfo(Long.parseLong(bankIdInfoUpdate));
- }else {
- bankInfo.setBankIdInfo(null);
- }
- bankInfo.setAccountName(accountNameUpdate);
- bankInfo.setBankName(bankNameUpdate);
- bankInfo.setBankNo(bankAccountNumberUpdate);
- }
- request.setBankInfo(bankInfo);
- request.setFirstName(firstNameUpdate);
- request.setMiddleName(middleNameUpdate);
- request.setLastName(lastNameUpdate);
- request.setProfileEmail(emailUpdate);
- request.setGender(genderUpdate);
- request.setCurrentCity(currentCityUpdate);
- request.setCurrentDistrict(currentDistrictUpdate);
- request.setCurrentAddress(currentAddressUpdate);
- request.setPermanentCity(permanentCityUpdate);
- request.setPermanentDistrict(permanentDistrictUpdate);
- request.setPermanentAddress(permanentAddressUpdate);
- request.setOccupation(occupationUpdate);
- request.setPosition(positionUpdate);
- request.setNationality(nationalityUpdate);
- request.setInfoIdNo(nationalIdUpdate);
- request.setDateOfBirth(Utils.converDateTimeZone(lastDateOfBirth));
- if(!StringUtils.isEmpty(identitytypeUpdate)) {
- request.setProfileIdentityType(Integer.valueOf(identitytypeUpdate));
- }
- request.setNationality(nationalityUpdate);
- request.setInformationDateInssuance(Utils.converDateTimeZone(dateIssuanceUpdate));
- request.setInformationPlaceInsuance(placeResidenceUpdate);
- request.setCardPictures(cardPicturesList);
- log.info(String.format("kycType is %s", kycType));
- request.setKycType(Integer.valueOf(kycType));
- try {
- UpdateMemberCustomerResponse dResponse = walletRestAPIService.updateMemberCustomerResponse(request);
- if(dResponse != null && !StringUtils.isEmpty(dResponse.getCode()) && dResponse.getCode().equals(SUCCESSMESSAGE)) {
- model.put(messageUpdateString, "success");
- model.put("messageContent", notify("vnwallet.table.column.action.update.message.success"));
- } else {
- if(dResponse != null && !StringUtils.isEmpty(dResponse.getCode()) && dResponse.getCode().equals(ACCESSTOKENEXPIRED)) {
- return REDIRECT_LOGOUT;
- } else {
- model.put(messageUpdateString, "error");
- String error = notify(
- "vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + dResponse.getMsg();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- }
- }
- } catch (WalletFrontException e) {
- log.error(e.getErrorMessage(), e);
- model.put(messageUpdateString, "error");
- String error = notify("vnwallet.table.column.action.update.message.failed")
- + notify("vnwallet.list.detail.message.error.service")
- + e.getErrorMessage();
- model.put(messageErrorString, error);
- log.info("updateMemberCustomer Error {}", error);
- model.put("emailUpdate", emailUpdate);
- model.put("genderUpdate", genderUpdate);
- model.put("currentCityUpdate", currentCityUpdate);
- model.put("currentDistrictUpdate", currentDistrictUpdate);
- model.put("currentAddressUpdate", currentAddressUpdate);
- model.put("permanentCityUpdate", permanentCityUpdate);
- model.put("permanentDistrictUpdate", permanentDistrictUpdate);
- model.put("permanentAddressUpdate", permanentAddressUpdate);
- model.put("occupationUpdate", occupationUpdate);
- model.put("positionUpdate", positionUpdate);
- model.put("nationalityUpdate", nationalityUpdate);
- model.put("identitytypeUpdate", identitytypeUpdate);
- model.put("nationalIdUpdate", nationalIdUpdate);
- model.put("dateIssuanceUpdate", dateIssuanceUpdate);
- model.put("placeResidenceUpdate", placeResidenceUpdate);
- model.put("bankNameUpdate", bankNameUpdate);
- model.put("bankAccountNumberUpdate", bankAccountNumberUpdate);
- model.put("accountNameUpdate", accountNameUpdate);
- model.put("firstNameUpdate", firstNameUpdate);
- model.put("middleNameUpdate", middleNameUpdate);
- model.put("lastNameUpdate", lastNameUpdate);
- model.put(DATE_OF_BIRTH, lastDateOfBirth);
- }
- }
- }
- }
- }}}}}
- }
- }
- }
- return "redirect:"+SharedConstants.APPLICATION_DOMAIN_PUBLIC+"/users/detail?phone=" + phoneNumber;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement