身份证校验算法

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

def id = params.id+""
		if(id){
			def v = [7 ,9 ,10 ,5 ,8 ,4 ,2 ,1 ,6 ,3 ,7 ,9 ,10 ,5 ,8,4,2]
			def total = 0
			id.eachWithIndex {item,index ->
				if(index < v.size()){
					total += (item as int )*( v[index])
				}
			}
			def num = 10-total%11
			def yushu = (num +2)%11
			if(yushu ==10)
				println 'X'
			else
				println yushu
		}