Commit 65490767 authored by ma's avatar ma

改正身份证脱敏方法

parent 8951c836
...@@ -14,12 +14,7 @@ import java.security.NoSuchAlgorithmException; ...@@ -14,12 +14,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -135,11 +130,6 @@ public class CommonUtil { ...@@ -135,11 +130,6 @@ public class CommonUtil {
return result; return result;
} }
public static void main(String[] args) {
boolean b = checkPassword("1234qwe123");
System.out.println(b);
}
/** /**
* 密码验证 * 密码验证
* (至少由8位及以上大写字母、小写字母、数字与特殊符号等4类中3类混合) * (至少由8位及以上大写字母、小写字母、数字与特殊符号等4类中3类混合)
...@@ -314,10 +304,11 @@ public class CommonUtil { ...@@ -314,10 +304,11 @@ public class CommonUtil {
if (StringUtils.isEmpty(idcard) || (idcard.length() < 8)) { if (StringUtils.isEmpty(idcard) || (idcard.length() < 8)) {
return idcard; return idcard;
} }
String res = StringUtils.overlay(idcard, "**************", 0, 14); String res = StringUtils.overlay(idcard, "***********", 3, 14);
return res; return res;
} }
public static String getCurDateStr() { public static String getCurDateStr() {
Date date = new Date(); Date date = new Date();
String pattern = "yyyy-MM-dd"; String pattern = "yyyy-MM-dd";
......
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