add idcard validate

This commit is contained in:
Looly 2020-05-05 16:52:03 +08:00
parent 4aee10da40
commit 3d11e2baa2
2 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@
* 【core 】 增加IoUtil.writeObjissue#I1FZIE
* 【core 】 增加FastStringWriter
* 【core 】 增加NumberUtil.ceilDiv方法pr#858@Github
* 【core 】 IdcardUtil增加省份校验issue#859@Github
### Bug修复
* 【core 】 修复URLBuilder中请求参数有`&`导致的问题issue#850@Github

View File

@ -218,6 +218,12 @@ public class IdcardUtil {
return false;
}
// 省份
final String proCode = idCard.substring(0, 2);
if (null == CITY_CODES.get(proCode)) {
return false;
}
//校验生日
if (false == Validator.isBirthday(idCard.substring(6, 14))) {
return false;