Commit 56e2f06a by 陈浩建

身份证号最后一位小写转大写

parent 533fd782
......@@ -24,7 +24,7 @@ public class IDCardUtil {
* @return true 有效:false 无效
*/
public static boolean IDCardValidate(String iDStr) {
Pattern p = Pattern.compile("(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)");
Pattern p = Pattern.compile("(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X)$)");
String[] ValCodeArr = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
String[] Wi = {"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"};
String Ai = "";
......@@ -168,4 +168,19 @@ public class IDCardUtil {
return hashtable;
}
/**
* 功能:身份证号码最后一位小写转为大写
*
* @param iDStr 身份证号
* @return
*/
public static String IdCardConversion(String iDStr){
String idFront = iDStr.substring(0, iDStr.length() -1);
String idLast = iDStr.substring(iDStr.length()-1, iDStr.length());
if("x".equals(idLast)){
idLast = "X";
iDStr = idFront + idLast;
}
return iDStr;
}
}
......@@ -182,6 +182,10 @@ public class PackageNewClothes {
return pac;
}
/**
* 身份证验证最后一位 x =》 X
*/
idCard = IDCardUtil.IdCardConversion(idCard);
/**
* 身份证验证
*/
if(!IDCardUtil.IDCardValidate(idCard)){
......@@ -339,6 +343,10 @@ public class PackageNewClothes {
return pac;
}
/**
* 身份证验证最后一位 x =》 X
*/
idCard = IDCardUtil.IdCardConversion(idCard);
/**
* 身份证验证
*/
if(!IDCardUtil.IDCardValidate(idCard)){
......@@ -470,6 +478,11 @@ public class PackageNewClothes {
,@RequestParam(value = "sell",required = false)String sell) {
/**
* 身份证验证最后一位 x =》 X
*/
idCard = IDCardUtil.IdCardConversion(idCard);
/**
* 办理中+94天内订单判断
*/
Calendar instance = Calendar.getInstance();
......
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