This commit is contained in:
linfso 2024-06-04 21:33:49 +08:00
parent 3c57e43f2c
commit 3d42bc4338
5 changed files with 116 additions and 7 deletions

View File

@ -113,6 +113,37 @@ public class EmisBaseService {
@Autowired
private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper;
/**
* 获取客户完整手机号 国家+电话 eg: 0086-1381861188
* @param countryCode
* @param phone
* @return
*/
public String getCompletePhone(String countryCode,String phone){
if(StringUtils.isAnyEmpty(phone,countryCode) ){
return phone;
}
phone = phone.trim(); //去除头尾空白符
if(StringUtils.isEmpty(phone)){
return "";
}
String str2 = "";
for(int i = 0;i < phone.length();i++) {
//对字符串的每个字符进行处理,如果在0-9之间就追加到str2上
if(phone.charAt(i) >= 48 && phone.charAt(i) <= 57) {
str2 += phone.charAt(i);
}
}
// 去除左边的0
// countryCode = countryCode.replaceAll("^(0+)", "");
phone = phone.replaceAll("^(0+)", "");
return countryCode+"-"+phone;
}
/**
* 获取当前登录用户
* @return

View File

@ -375,7 +375,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
sendAddress.setAddress(emisWaybillSave.getSendAddress());
sendAddress.setCompany(emisWaybillSave.getSendCompany());
sendAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode());
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
sendAddress.setAddressType("1");
// 收件地址
@ -391,7 +391,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
recieveAddress.setAddress(emisWaybillSave.getReceiveAddress());
recieveAddress.setCompany(emisWaybillSave.getReceiveCompany());
recieveAddress.setUseSiteCode(getCurrentUser().getOwnerSiteCode());
recieveAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
recieveAddress.setAddressType("2");
// 计算单据归属
@ -415,6 +415,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 到付
else if( "3".equals(emisWaybillSave.getPaymentType()) ) {
//
// 通过电话判断客户是否存在
EmisCustomerUser emisCustomerUser=getCustomerUserByPhone(recieveAddress.getPhone());
if(emisCustomerUser!=null){
@ -451,7 +452,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 寄付和其他
else{
// 通过电话判断客户是否存在
EmisCustomerUser emisCustomerUser=getCustomerUserByPhone(sendAddress.getPhone());
String sendPhone=getCompletePhone(sendAddress.getCounty(),sendAddress.getPhone())
EmisCustomerUser emisCustomerUser=getCustomerUserByPhone(sendPhone);
if(emisCustomerUser!=null){
customerCode=emisCustomerUser.getCustomerCode();
customerName=emisCustomerUser.getCustomerName();
@ -461,7 +463,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
newEmisCustomerUser.setCustomerName(sendAddress.getName());
newEmisCustomerUser.setCountry(sendAddress.getCountry());
newEmisCustomerUser.setPhone(sendAddress.getPhone());
newEmisCustomerUser.setPhone(sendPhone);
newEmisCustomerUser.setProvince(sendAddress.getProvince());
newEmisCustomerUser.setCity(sendAddress.getCity());
newEmisCustomerUser.setCounty(sendAddress.getCounty());
@ -473,6 +475,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
newEmisCustomerUser.setSettledType("1");
newEmisCustomerUser.setUserType("1");
newEmisCustomerUser.setSalesmen(emisWaybillSave.getSalesmen());
newEmisCustomerUser.setPayee(emisWaybillSave.getPayee());
// 预置主归属网点
newEmisCustomerUser.setOwnerSite(emisWaybillSave.getSendSiteCode());
EmisCustomerUser newUser=createCustomerUser(newEmisCustomerUser);

View File

@ -0,0 +1,6 @@
package com.xdadan.erp.emis.utils;
public class PhoneNumberUtils {
}

View File

@ -0,0 +1,70 @@
package com.xdadan.erp.emis.utils;
public enum PhoneRegularExp {
//国际手机 区号
CN("中国", "^(\\+?0?86\\-?)?1[345789]\\d{9}$"),
TW("台湾", "^(\\+?886\\-?|0)?9\\d{8}$"),
HK("香港", "^(\\+?852\\-?)?[569]\\d{3}\\-?\\d{4}$"),
MS("马来西亚", "^(\\+?6?01){1}(([145]{1}(\\-|\\s)?\\d{7,8})|([236789]{1}(\\s|\\-)?\\d{7}))$"),
PH("菲律宾", "^(\\+?0?63\\-?)?\\d{10}$"),
TH("泰国", "^(\\+?0?66\\-?)?\\d{10}$"),
SG("新加坡", "^(\\+?0?65\\-?)?\\d{10}$"),
DZ("阿尔及利亚", "^(\\+?213|0)(5|6|7)\\d{8}$"),
SY("叙利亚", "^(!?(\\+?963)|0)?9\\d{8}$"),
SA("沙特阿拉伯", "^(!?(\\+?966)|0)?5\\d{8}$"),
US("美国", "^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$"),
CZ("捷克共和国", "^(\\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$"),
DE("德国", "^(\\+?49[ \\.\\-])?([\\(]{1}[0-9]{1,6}[\\)])?([0-9 \\.\\-\\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$"),
DK("丹麦", "^(\\+?45)?(\\d{8})$"),
GR("希腊", "^(\\+?30)?(69\\d{8})$"),
AU("澳大利亚", "^(\\+?61|0)4\\d{8}$"),
GB("英国", "^(\\+?44|0)7\\d{9}$"),
CA("加拿大", "^(\\+?1)?[2-9]\\d{2}[2-9](?!11)\\d{6}$"),
IN("印度", "^(\\+?91|0)?[789]\\d{9}$"),
NZ("新西兰", "^(\\+?64|0)2\\d{7,9}$"),
ZA("南非", "^(\\+?27|0)\\d{9}$"),
ZM("赞比亚", "^(\\+?26)?09[567]\\d{7}$"),
ES("西班牙", "^(\\+?34)?(6\\d{1}|7[1234])\\d{7}$"),
FI("芬兰", "^(\\+?358|0)\\s?(4(0|1|2|4|5)?|50)\\s?(\\d\\s?){4,8}\\d$"),
FR("法国", "^(\\+?33|0)[67]\\d{8}$"),
IL("以色列", "^(\\+972|0)([23489]|5[0248]|77)[1-9]\\d{6}"),
HU("匈牙利", "^(\\+?36)(20|30|70)\\d{7}$"),
IT("意大利", "^(\\+?39)?\\s?3\\d{2} ?\\d{6,7}$"),
JP("日本", "^(\\+?81|0)\\d{1,4}[ \\-]?\\d{1,4}[ \\-]?\\d{4}$"),
NO("挪威", "^(\\+?47)?[49]\\d{7}$"),
BE("比利时", "^(\\+?32|0)4?\\d{8}$"),
PL("波兰", "^(\\+?48)? ?[5-8]\\d ?\\d{3} ?\\d{2} ?\\d{2}$"),
BR("巴西", "^(\\+?55|0)\\-?[1-9]{2}\\-?[2-9]{1}\\d{3,4}\\-?\\d{4}$"),
PT("葡萄牙", "^(\\+?351)?9[1236]\\d{7}$"),
RU("俄罗斯", "^(\\+?7|8)?9\\d{9}$"),
RS("塞尔维亚", "^(\\+3816|06)[- \\d]{5,9}$"),
R("土耳其", "^(\\+?90|0)?5\\d{9}$"),
VN("越南", "^(\\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$");
/**
* 国际名称
*/
private String national;
/**
* 正则表达式
*/
private String regularExp;
public String getNational() {
return national;
}
public void setNational(String national) {
this.national = national;
}
public String getRegularExp() {
return regularExp;
}
public void setRegularExp(String regularExp) {
this.regularExp = regularExp;
}
PhoneRegularExp(String national, String regularExp) {
this.national = national;
this.regularExp = regularExp;
}
}

View File

@ -221,10 +221,7 @@
and province = #{province}
and city = #{city}
and county = #{county}
and town = #{town}
and address = #{address}
and post_code = #{postCode}
and email = #{email}
and company = #{company}
and address_type = #{addressType}
limit 1