/****
* 根据身份证号计算年龄
* @param str
* @param currDate
* @return
*/
public boolean calcYear(String str, Date currDate){
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Long year = Long.parseLong(str.substring(0,4));
Long month = Long.parseLong(str.substring(4,6));
Long day = Long.parseLong(str.substring(6,8));
String str1 = dateFormat.format(currDate);
Long year1 = Long.parseLong(str1.substring(0,4));
Long month1 = Long.parseLong(str1.substring(4,6));
Long day1 = Long.parseLong(str1.substring(6,8));
Long num = year1-year;
Long mon = month1-month;
Long day2 = day1-day;
boolean bool= false;
if(num<16){
bool = true;
}else if(num==16){
if(mon<0||(mon==0 && day2<0)){
bool = true;
}else if(mon>0 ||(mon==0 && day2>=0)){
bool = false;
}
}
LOGGER.info("判断当前证件是未成年人的标识为:"+bool+"[True表示为未成年人,False表示为未成年人]");
return bool;
}