第一篇:java實現二代身份證信息查詢程序
本文是在java平臺上編寫的二代身份證信息查詢程序,可以查詢二代身份證的基本信息,包括文字信息和圖像信息。用到的Jar包是JNative.jar,這個很容易就能下載到,下載后添加到工程的外部jar庫中。另外,程序裝載了sdtapi.DLL和WltRS.DLL文件,這兩個文件必須放到C:WindowsSystem32目錄下。只有一個java文件,需要說明的是:用到的測試設備接口是RS232串口,USB的接口程序可自行修改。資料是在網上用積分買的,現免費共享給手上沒有積分的朋友下載。
package com.a;
import javax.swing.*;import org.xvolks.jnative.JNative;import org.xvolks.jnative.Type;import org.xvolks.jnative.exceptions.NativeException;import org.xvolks.jnative.pointers.Pointer;import org.xvolks.jnative.pointers.memory.MemoryBlockFactory;import java.awt.*;import javax.imageio.ImageIO;import java.io.*;import java.util.StringTokenizer;import java.awt.event.*;
public class IdentityInfoReader extends JFrame implements ActionListener { private static final long serialVersionUID =-***8441L;JLabel[] label = new JLabel[10];JButton showBmp;JTextField[] text = new JTextField[9];String[] labelItem = {“姓名:”, “性別:”, “民族:”, “出生年月:”, “地址:”, “身份證號:”, “簽發機構:”, “期限起始:”, “期限終止:”};JNative openJN = null, findJN = null, selectJN = null, readJN = null, MngJN = null, BmpJN = null, closeJN = null;JButton readJB, exitJB;int iPort = 1;int iIfOpen = 1;
public InformationReader(String str){
super(str);
System.loadLibrary(“sdtapi”);
try {
try {
init();
} catch(NativeException e){
} catch(UnsupportedEncodingException e){
e.printStackTrace();
}
} catch(IllegalAccessException e){
}
label[0] = new JLabel(“二代身份證信息”);
label[0].setBounds(200, 20, 95, 25);
getContentPane().add(label[0]);
for(int j = 1;j < labelItem.length + 1;j++){
label[j] = new JLabel(labelItem[j1]);} text[0].setText(Info[0]);if(Info[1].charAt(0)== '1'){ text[1].setText(“男”);} else if(Info[1].charAt(0)== '2')text[1].setText(“女”);char[] nationChar = new char[2];Info[1].getChars(1, 3, nationChar, 0);String nationStr = “";nationStr = String.valueOf(nationChar);if(nationStr.equals(”01“))text[2].setText(”漢“);else if(nationStr.equals(”02“))text[2].setText(”蒙古族“);else if(nationStr.equals(”03“))text[2].setText(”回族“);else if(nationStr.equals(”04“))text[2].setText(”藏族“);else if(nationStr.equals(”05“))text[2].setText(”維吾爾族“);else if(nationStr.equals(”06“))text[2].setText(”苗族“);else if(nationStr.equals(”07“))text[2].setText(”彝族“);else if(nationStr.equals(”08“))text[2].setText(”壯族“);else if(nationStr.equals(”09“))text[2].setText(”布依族“);else if(nationStr.equals(”10“))text[2].setText(”朝鮮族“);else if(nationStr.equals(”11“))text[2].setText(”滿族“);else if(nationStr.equals(”12“))text[2].setText(”侗族“);else if(nationStr.equals(”13“))text[2].setText(”瑤族“);else if(nationStr.equals(”14“))text[2].setText(”白族“);else if(nationStr.equals(”15“))text[2].setText(”土家族“);else if(nationStr.equals(”16“))text[2].setText(”哈尼族“);else if(nationStr.equals(”17“))text[2].setText(”哈薩克族“);else if(nationStr.equals(”18“))text[2].setText(”傣族“);else if(nationStr.equals(”19“))text[2].setText(”黎族“);
else if(nationStr.equals(”20“))text[2].setText(”傈僳族“);else if(nationStr.equals(”21“))text[2].setText(”佤族“);else if(nationStr.equals(”22“))text[2].setText(”畬族“);else if(nationStr.equals(”23“))text[2].setText(”高山族“);else if(nationStr.equals(”24“))text[2].setText(”拉祜族“);else if(nationStr.equals(”25“))text[2].setText(”水族“);else if(nationStr.equals(”26“))text[2].setText(”東鄉族“);else if(nationStr.equals(”27“))text[2].setText(”納西族“);else if(nationStr.equals(”28“))text[2].setText(”景頗族“);else if(nationStr.equals(”29“))text[2].setText(”柯爾克孜族“);else if(nationStr.equals(”30“))text[2].setText(”土族“);else if(nationStr.equals(”31“))text[2].setText(”達翰爾族“);else if(nationStr.equals(”32“))text[2].setText(”仫佬族“);else if(nationStr.equals(”33“))text[2].setText(”羌族“);else if(nationStr.equals(”34“))text[2].setText(”布朗族“);else if(nationStr.equals(”35“))text[2].setText(”撒拉族“);else if(nationStr.equals(”36“))text[2].setText(”毛南族“);else if(nationStr.equals(”37“))text[2].setText(”仡佬族“);else if(nationStr.equals(”38“))text[2].setText(”錫伯族“);else if(nationStr.equals(”39“))text[2].setText(”阿昌族“);else if(nationStr.equals(”40“))text[2].setText(”普米族“);else if(nationStr.equals(”41“))text[2].setText(”哈薩克族“);else if(nationStr.equals(”42“))text[2].setText(”怒族“);else if(nationStr.equals(”43“))text[2].setText(”烏孜別克族“);else if(nationStr.equals(”44“))text[2].setText(”俄羅斯族“);else if(nationStr.equals(”45“))text[2].setText(”鄂溫克族“);else if(nationStr.equals(”46“))
text[2].setText(”德昂族“);
else if(nationStr.equals(”47“))
text[2].setText(”保安族“);
else if(nationStr.equals(”48“))
text[2].setText(”裕固族“);
else if(nationStr.equals(”49“))
text[2].setText(”京族“);
else if(nationStr.equals(”50“))
text[2].setText(”塔塔爾族“);
else if(nationStr.equals(”51“))
text[2].setText(”獨龍族“);
else if(nationStr.equals(”52“))
text[2].setText(”鄂倫春族“);
else if(nationStr.equals(”53“))
text[2].setText(”赫哲族“);
else if(nationStr.equals(”54“))
text[2].setText(”門巴族“);
else if(nationStr.equals(”55“))
text[2].setText(”珞巴族“);
else if(nationStr.equals(”56“))
text[2].setText(”基諾族“);
else if(nationStr.equals(”57“))
text[2].setText(”其它“);
else if(nationStr.equals(”98“))
text[2].setText(”外國人入籍“);
String BirthyearStr = ”“;
char[] BirthyearChar = new char[4];
Info[1].getChars(3, 7, BirthyearChar, 0);
BirthyearStr = String.valueOf(BirthyearChar);
String BirthmonthStr = ”“;
char[] BirthmonthChar = new char[2];
Info[1].getChars(7, 9, BirthmonthChar, 0);
BirthmonthStr = String.valueOf(BirthmonthChar);
String BirthdateStr = ”“;
char[] BirthdateChar = new char[2];
Info[1].getChars(9, 11, BirthdateChar, 0);
BirthdateStr = String.valueOf(BirthdateChar);
text[3].setText(BirthyearStr + ”年“ + BirthmonthStr + ”月“ + BirthdateStr + ”日“);
char[] addressChar = new char[Info[1].length()18];
Info[2].getChars(18, Info[2].length(), issueChar, 0);
String issueStr = ”“;
issueStr = String.valueOf(issueChar);
text[6].setText(issueStr);
char[] startyearChar = new char[4];
Info[3].getChars(0, 4, startyearChar, 0);
String startyearStr = ”“;
startyearStr = String.valueOf(startyearChar);
char[] startmonthChar = new char[2];
Info[3].getChars(4, 6, startmonthChar, 0);
String startmonthStr = ”“;
startmonthStr = String.valueOf(startmonthChar);
char[] startdateChar = new char[2];
Info[3].getChars(6, 8, startdateChar, 0);
String startdateStr = ”“;
startdateStr = String.valueOf(startdateChar);
text[7].setText(startyearStr + ”年“ + startmonthStr + ”月“ + startdateStr + ”日“);
char[] endyearChar = new char[4];
Info[3].getChars(8, 12, endyearChar, 0);
String endyearStr = ”“;
endyearStr = String.valueOf(endyearChar);
char[] endmonthChar = new char[2];
Info[3].getChars(12, 14, endmonthChar, 0);
String endmonthStr = ”“;
endmonthStr = String.valueOf(endmonthChar);
char[] enddateChar = new char[2];
Info[3].getChars(14, 16, enddateChar, 0);
String enddateStr = ”“;
enddateStr = String.valueOf(enddateChar);
text[8].setText(endyearStr + ”年“ + endmonthStr + ”月“ + enddateStr + ”日“);
int count1 = d.getSize();
byte[] byteArray1 = new byte[count1];
for(i = 0;i < count1;i++)
byteArray1[i] = c.getAsByte(i);
try {
File myFile = new File(”zp.wlt“);
FileOutputStream out = new FileOutputStream(myFile);
out.write(byteArray1, 0, count1-1);
} catch(IOException t){
}
closeJN.invoke();
// System.out.println(closeJN.getRetVal());
int l = 0;
System.loadLibrary(”WltRS“);
BmpJN = new JNative(”WltRS“, ”GetBmp“);
BmpJN.setRetVal(Type.INT);
BmpJN.setParameter(l++, ”zp.wlt“);
BmpJN.setParameter(l++, 1);
BmpJN.invoke();
if(readJN.getRetVal().equals(”144“))
System.out.println(”相片解碼成功!“);
else
System.out.println(”相片解碼不成功!“);
Image image = null;
try {
image = ImageIO.read(new File(”zp.bmp“));
} catch(IOException ex){
}
ImageIcon icon = new ImageIcon(image);
showBmp.setIcon(icon);
getContentPane().add(showBmp);
setVisible(true);
a.dispose();
b.dispose();
c.dispose();
d.dispose();
e.dispose();
} catch(NativeException e){
} catch(UnsupportedEncodingException e){
e.printStackTrace();
}
} catch(IllegalAccessException e){
} }
public static void main(String agrs[]){
InformationReader informationReader = new InformationReader(”二代身份證信息讀取");
informationReader.setSize(500, 500);} }
第二篇:簡單的員工信息查詢java程序
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;
public class Employee extends JFrame implements ActionListener{
String titles[]={“工號:”,“姓名:”,“性別:”,“出生日期:”,“聯系電話:”,“家庭住址:”,“個人情況:”};
JTextField employeeID=new JTextField(8);
JTextField employeeName=new JTextField(8);
JTextField employeeSex=new JTextField(2);
JTextField employeeBirthday=new JTextField(6);
JTextField employeePhone=new JTextField(11);
JTextField employeeAddress=new JTextField(20);
JTextArea employeeResume=new JTextArea();
JButton first=new JButton(“首頁”);
JButton next=new JButton(“下一條”);
JButton previous=new JButton(“上一條”);
JButton last=new JButton(“尾頁”);
Statement stmt;
ResultSet rs;
Employee(){
super(“員工信息查詢”);
setSize(350,330);
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection conn=DriverManager.getConnection(“jdbc:odbc:mydb”,“sa”,“123”);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(“select * from mdb”);
getContentPane().setLayout(new BorderLayout(0,8));
JPanel p[]=new JPanel[6];
for(int i=0;i<6;i++){
p[i]=new JPanel(new FlowLayout(FlowLayout.LEFT,10,0));
p[i].add(new JLabel(titles[i]));
}
p[0].add(employeeID);
p[1].add(employeeName);
p[2].add(employeeSex);
p[3].add(employeeBirthday);
p[4].add(employeePhone);
p[5].add(employeeAddress);
JPanel p1=new JPanel(new GridLayout(6,1,0,8));
JScrollPane jsp=new JScrollPane(employeeResume,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jsp.setPreferredSize(new Dimension(250,80));
for(int i=0;i<6;i++)
p1.add(p[i]);
JPanel p2=new JPanel(new FlowLayout(FlowLayout.LEFT,10,0));
p2.add(new JLabel(titles[6]));
p2.add(jsp);
JPanel p3=new JPanel();
p3.add(first);
p3.add(previous);
p3.add(next);
p3.add(last);
getContentPane().add(p1,“North”);
getContentPane().add(p2,“Center”);
getContentPane().add(p3,“South”);
next.addActionListener(this);
previous.addActionListener(this);
first.addActionListener(this);
last.addActionListener(this);
rs.first();
display();
}catch(Exception e){e.printStackTrace();}
setVisible(true);
}
public void actionPerformed(ActionEvent e){
try{
if(e.getSource()==next)rs.next();
else if(e.getSource()==previous)rs.previous();
else if(e.getSource()==first)rs.first();
else if(e.getSource()==last)rs.last();
display();
}catch(Exception ee){ee.printStackTrace();}
}
boolean display(){
try{
employeeID.setText(rs.getString(“employeeID”));
employeeName.setText(rs.getString(“employeeName”));
employeeSex.setText(rs.getString(“employeeSex”));
employeeBirthday.setText(rs.getString(“employeeBirthday”));
employeePhone.setText(rs.getString(“employeePhone”));
employeeAddress.setText(rs.getString(“employeeAddress”));
}employeeResume.setText(rs.getString(“employeeResume”));}catch(SQLException e){e.printStackTrace();return false;}return true;}public static void main(String[] args){JFrame.setDefaultLookAndFeelDecorated(true);Employee em=new Employee();}
第三篇:身份證信息查詢接口 查詢身份證具體信息
身份證信息查詢接口 查詢身份證具體信息
身份證信息查詢接口可以查詢身份證上具體信息,包括地區、性別、出生日期等情況。接口名稱:身份證信息查詢接口 接口平臺:聚合數據
接口地址:http://apis.juhe.cn/idcard/index 支持格式:JSON/XML 請求方式:get 請求示例:http://apis.juhe.cn/idcard/index?key=KEY&cardno=***211 請求參數: 名稱 cardno dtype key 類型 必填
說明 身份證號碼
返回數據格式:json或xml,默認json 你申請的key
您
申
請的string Y string Y string Y 調用樣例及調試工具:
API測試工具 返回字段: 名稱 error_code reason data area sex
類型 int string-string string
說明 返回碼 返回說明 返回結果集 地區 性別 birthday
string 出生日期
身份證號碼歸屬地數據庫調用代碼JSON返回示例: { “resultcode”:“200”, “reason”:“成功的返回”, “result”:{ “area”:“浙江省溫州市平陽縣”, “sex”:“男”, “birthday”:“1989年03月08日” } } 身份證號碼歸屬地數據庫調用代碼XML返回示例:
第四篇:更換二代身份證的通知
關于做好城鄉居民養老保險制度實施前參保人員更
換二代身份證的通知
各鎮(區)政府,縣直有關部門、直屬機構、企事業單位:
開展城鄉居民社會養老保險試點工作是縣委、縣政府今年為民辦的一件實事。按照縣委、縣政府的有關工作要求,我縣城鄉居民養老保險試點工作準備啟動,將于7、8月份組織農村居民進行參保登記、費用征繳、養老金發放等工作。各鎮(區)要依據參保人員二代身份證建立詳細的參保信息檔案,并納入全縣計算機信息管理系統。代辦銀行將為參保的居民開設參保繳費和發放養老金存折。為確保計算機信息準確和代辦銀行存折開設成功,保證符合領取養老金待遇的居民按時領取養老金,確保城鄉居民養老保險試點工作順利開展,現就符合參保條件的城鄉居民補辦或更換二代身份證工作通知如下:
一、各鎮(區)、有關部門要高度重視,迅速進行安排部署,廣泛宣傳,積極動員廣大城鄉居民補辦或更換二代身份證。
二、鎮(區)公安分局、派出所要做好服務工作,安排各基層派出所抽調專人,負責補辦或更換二代身份證,積極配合、支持各鎮(區)開展工作。
三、無身份證或身份證遺失的農村居民、沒有更換二代身份證的農村居民務必在6月底前補辦或更換。
四、在辦理城鄉居民養老保險參保登記時,無二代身份證的城鄉居民,將不受理參保登記,不予發放養老金。
第五篇:身份證相關信息
一、身份證號碼執行標準:18位身份證標準在國家質量技術監督局于1999年7月1日實施的GB11643-1999《公民身份號碼》。
GB11643-1999《公民身份號碼》為GB11643-1989《社會保障號碼》的修訂版,其中指出將原標準名稱“社會保障號碼”更名為“公民身份號碼”,另外GB11643-1999《公民身份號碼》從實施之日起代替GB11643-1989。
二、編碼規則:公民身份號碼是特征組合碼,由十七位數字本體碼和一位校驗碼組成。排列順序從左至右依次為:六位數字地址碼,八位數字出生日期碼,三位數字順序碼和一位校驗碼,可以用字母表示如為ABCDEFYYYYMMDDXXXR。其含義如下:
1.地址碼(ABCDEF):表示編碼對象常住戶口所在縣(市、旗、區)的行政區劃代碼,按GB/T2260的規定執行。
2.出生日期碼(YYYYMMDD):表示編碼對象出生的年、月、日,按GB/T7408的規定執行,年、月、日分別用4位、2位(不足兩位加0)、2(同上)位數字表示,之間不用分隔符。
3.順序碼(XXX):表示在同一地址碼所標識的區域范圍內,對同年、同月、同日出生的人編定的順序號,順序碼的奇數分配給男性,偶數分配給女性。
4.校驗碼(R),一位數字,通過前17位數字根據一定計算得出。
三、關于地址碼含義的詳細解釋:
身份證前六位是地區代碼,我們用ABCDEF表示。代碼的解釋規則如下:
A:國內區域
華北三省二市
東北三省
華東六省一市
華南六省
西南四省一市 6 西北五省
臺灣
港澳
B(或者說是AB,就是前2位):省(直轄市,自治區,特別行政區)代碼
按照A劃定的分區定義省代碼,有直轄市的,直轄市列前,其余按離直轄市的距離排序,沒有直轄市的,按離北京的遠近排序。
具體省(直轄市,自治區,特別行政區)代碼如下:
11-15 京 津 冀 晉 蒙
21-23 遼 吉 黑
31-37 滬 蘇 浙 皖 閩 贛 魯
41-46 豫 鄂 湘 粵 桂 瓊
50-54 渝 川 貴 云 藏
61-65 陜 甘 青 寧 新
81-82 港 澳
CD:城市代碼
從01開始排,對于直轄市,CD=01表示市轄區,CD=02表示轄縣;省的城市代碼從省會開始排,比如2101=沈陽 2102=大連?? 只有地級城市有獨立的城市代碼,縣級市沒有。
EF:市轄區、郊區、郊縣、縣級市代碼
如果EF=00,指代這個城市,不特定區縣;對于非直轄市,如EF=01,指代市轄區(任意一個區),02開始指代特定的區。
其中:
E=0代表市轄區,E=1代表郊區,E=2代表郊縣,E=8代表縣級市。
對于直轄市,從01開始就依次排區,沒有市區和郊區的代碼區分。:
有關更詳細的資料見附錄。
四、生日期碼(YYYYMMDD)表示編碼對象出生的年、月、日,其中年份用四位數字表示,年、月、日之間不用分隔符。例如:1981年05月11日就用19810511表示。
五、順序碼(XXX)(身份證第十五位到十七位)是縣、區級政府所轄派出所的分配碼,每個派出所分配碼為10個連續號碼,例如“000-009”或“060-069”,其中單數為男性分配碼,雙數為女性分配碼,如遇同年同月同日有兩人以上時順延第二、第三、第四、第五個分配碼。如:007的就是個男生,而且和他同年月日生的男生至少有兩個,他們的后四位是001*和003*。分配順序碼中“999、998、997、996”四個順序號分別為男女性百歲以上老人專用的特定編號。
六、關于校驗碼
校驗碼是通過一系列數學計算得出來的,具體校驗的計算方式如下:
1.對前17位數字本體碼加權求和
公式為:S = Sum(Ai * Wi), i = 0,..., 16
其中Ai表示第i位置上的身份證號碼數字值,Wi表示第i位置上的加權因子,其各位對應的值依次為: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
通俗解釋:身份證第一位數字X7+第二位X9+第三位X10+第四位X5+第五位X5+第六位X8+第七位X4+第八位X1+第九位X6+第十位X3+十一位X7+十二位X9+十三位X10+十四位X5+十五位X8+十六位X4+十七位X2;計算出總和(用S)表示。2.以11對計算結果取模
Y = mod(S, 11)
通俗解釋:用S除以11,看最后的余數。如果除盡,為0;余數為1,則計為1;最大余數為10;全部數字為0-10共11個數字。(用Y表示)。
3.根據模的值得到對應的校驗碼
對應關系為:
Y值: 0 1 2 3 4 5 6 7 8 9 10
校驗碼: 1 0 X 9 8 7 6 5 4 3 2
通俗解釋:余數為0,則校驗碼為1;依次類推:余數為1,則校驗碼對應0;以下:2--X;3--9;4--8;5--7;6--6;7--5;8--4;9-3;10-2。
如果校驗碼不符合這個規則,則肯定是假號碼。
關于18位身份證號碼尾數是“X”的一種解釋:因為按照上面的規則,校驗碼有11個,而不是10個,所以不能用0-9表示。所以如果尾號是10,那么就得用X來代替,因為如果用10做尾號,那么此人的身份證就變成了19位,而19位的號碼違反了國家標準,并且我國的計算機應用系統也不承認19位的身份證號碼。Ⅹ是羅馬數字的10,用X來代替10,可以保證公民的身份證符合國家標準。
根據〖中華人民共和國國家標準 GB 11643-1999〗中有關公民身份號碼的規定,公民身份號碼是特征組合碼,由十七位數字本體碼和一位數字校驗碼組成。排列順序從左至右依次為:六位數字地址碼,八位數字出生日期碼,三位數字順序碼和一位數字校驗碼。