Commit 3e9013f4 authored by ='s avatar =
parents 267b9d95 934f252c
...@@ -1262,7 +1262,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1262,7 +1262,7 @@ public class CustomerServiceImpl implements CustomerService {
Customer saved = customerRepository.save(c); Customer saved = customerRepository.save(c);
if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0]) if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])
&& rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])] != null) { && rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])] != null) {
String[] mainPhone = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim().split(";"); String[] mainPhone = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim().split("[,;]");
for (int j = 0; j < mainPhone.length; j++) { for (int j = 0; j < mainPhone.length; j++) {
CustomerContact cc = new CustomerContact(); CustomerContact cc = new CustomerContact();
cc.setCustomerId(saved.getCustomerId()); cc.setCustomerId(saved.getCustomerId());
...@@ -1280,7 +1280,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1280,7 +1280,7 @@ public class CustomerServiceImpl implements CustomerService {
} }
if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0]) if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])
&& rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])] != null) { && rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])] != null) {
String[] subPhone = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim().split(";"); String[] subPhone = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim().split("[,;]");
for (int j = 0; j < subPhone.length; j++) { for (int j = 0; j < subPhone.length; j++) {
CustomerContact cc = new CustomerContact(); CustomerContact cc = new CustomerContact();
cc.setCustomerId(saved.getCustomerId()); cc.setCustomerId(saved.getCustomerId());
...@@ -1298,7 +1298,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1298,7 +1298,7 @@ public class CustomerServiceImpl implements CustomerService {
} }
if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0]) if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0])
&& rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0])] != null) { && rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0])] != null) {
String[] email = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0])].toString().split(";"); String[] email = rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.email", locale).split("#")[0])].toString().split("[,;]");
for (int j = 0; j < email.length; j++) { for (int j = 0; j < email.length; j++) {
CustomerContact cc = new CustomerContact(); CustomerContact cc = new CustomerContact();
cc.setCustomerId(saved.getCustomerId()); cc.setCustomerId(saved.getCustomerId());
...@@ -1382,7 +1382,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1382,7 +1382,7 @@ public class CustomerServiceImpl implements CustomerService {
//<editor-fold desc="Validate Methods" defaultstate="collapsed"> //<editor-fold desc="Validate Methods" defaultstate="collapsed">
private String validateExistPhone(String str, Locale locale, boolean isCheckDuplicate) { private String validateExistPhone(String str, Locale locale, boolean isCheckDuplicate) {
String result = ""; String result = "";
String[] arr = str.split(";"); String[] arr = str.split("[;,]");
List<CustomerContact> contactList; List<CustomerContact> contactList;
if (str.length() > 50) { if (str.length() > 50) {
result += BundleUtils.getLangString("customer.phoneMax50", locale); result += BundleUtils.getLangString("customer.phoneMax50", locale);
...@@ -1411,7 +1411,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1411,7 +1411,7 @@ public class CustomerServiceImpl implements CustomerService {
private boolean validateNumberOnly(String str) { private boolean validateNumberOnly(String str) {
String regexp = "\\b\\d+\\b"; String regexp = "\\b\\d+\\b";
String[] arr = str.split(";"); String[] arr = str.split("[,;]");
int count = 0; int count = 0;
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
if (!arr[i].matches(regexp)) { if (!arr[i].matches(regexp)) {
...@@ -1423,7 +1423,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1423,7 +1423,7 @@ public class CustomerServiceImpl implements CustomerService {
private String validateDuplicateEmail(String str, Locale locale) { private String validateDuplicateEmail(String str, Locale locale) {
String result = ""; String result = "";
String[] arr = str.split(","); String[] arr = str.split("[;,]");
List<CustomerContact> contactList; List<CustomerContact> contactList;
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
contactList = customerContactRepository.findCustomerContactsByContactEquals(arr[i]); contactList = customerContactRepository.findCustomerContactsByContactEquals(arr[i]);
...@@ -1455,7 +1455,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1455,7 +1455,7 @@ public class CustomerServiceImpl implements CustomerService {
} }
private boolean validateEmail(String str) { private boolean validateEmail(String str) {
String[] arr = str.split(","); String[] arr = str.split("[;,]");
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
Matcher matcher = EMAIL_REGEXP.matcher(arr[i]); Matcher matcher = EMAIL_REGEXP.matcher(arr[i]);
if (!matcher.matches()) { if (!matcher.matches()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment