!303 idcard add age

Merge pull request !303 from dazer007/v5-dev
This commit is contained in:
Looly 2021-04-06 15:52:30 +08:00 committed by Gitee
commit 359fa788a8
2 changed files with 12 additions and 2 deletions

View File

@ -41,8 +41,8 @@ public class DateUtil extends CalendarUtil {
*/ */
private final static String[] wtb = { // private final static String[] wtb = { //
"sun", "mon", "tue", "wed", "thu", "fri", "sat", // 星期 "sun", "mon", "tue", "wed", "thu", "fri", "sat", // 星期
"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", // "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", // 月份
"gmt", "ut", "utc", "est", "edt", "cst", "cdt", "mst", "mdt", "pst", "pdt"// "gmt", "ut", "utc", "est", "edt", "cst", "cdt", "mst", "mdt", "pst", "pdt"// 时间标准
}; };
/** /**

View File

@ -662,6 +662,7 @@ public class IdcardUtil {
private final String cityCode; private final String cityCode;
private final DateTime birthDate; private final DateTime birthDate;
private final Integer gender; private final Integer gender;
private final int age;
/** /**
* 构造 * 构造
@ -673,6 +674,7 @@ public class IdcardUtil {
this.cityCode = IdcardUtil.getCityCodeByIdCard(idcard); this.cityCode = IdcardUtil.getCityCodeByIdCard(idcard);
this.birthDate = IdcardUtil.getBirthDate(idcard); this.birthDate = IdcardUtil.getBirthDate(idcard);
this.gender = IdcardUtil.getGenderByIdCard(idcard); this.gender = IdcardUtil.getGenderByIdCard(idcard);
this.age = IdcardUtil.getAgeByIdCard(idcard);
} }
/** /**
@ -720,6 +722,14 @@ public class IdcardUtil {
return this.gender; return this.gender;
} }
/**
* 获取年龄
* @return 年龄
*/
public int getAge() {
return age;
}
@Override @Override
public String toString() { public String toString() {
return "Idcard{" + return "Idcard{" +