身份证读取、社保卡读取优化

This commit is contained in:
2025-03-10 17:16:37 +08:00
parent 0e9a6b6cf0
commit 24820af27a
2 changed files with 156 additions and 189 deletions

View File

@@ -1,9 +1,7 @@
package com.dpkj.modules.cardReader.utils;
import com.dpkj.modules.autoReplyPrint.utils.AutoReplyPrint;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
public interface CardReaderSdk extends Library {
CardReaderSdk INSTANCE = (CardReaderSdk) Native.loadLibrary(GetLibraryPath_Helper.GetLibraryPath(), CardReaderSdk.class);
@@ -137,7 +135,7 @@ public interface CardReaderSdk extends Library {
* 0x3x非接CPU卡
* @return = 0 表示卡座有卡,其他见状态码
*/
Long ICC_Reader_GetStatus(Long ReaderHandle, String ICCSlotNo);
int ICC_Reader_GetStatus(Long ReaderHandle, int ICCSlotNo);
/**
@@ -275,8 +273,8 @@ public interface CardReaderSdk extends Library {
* @param ReaderHandle ICCReaderOpen函数所返回的值
* @return 返回错误信息 = 0 表示成功,非0失败
*/
Long PICC_Reader_ReadIDCard(Long ReaderHandle);
// int PICC_Reader_ReadIDCard(Long ReaderHandle, byte[] response);
// Long PICC_Reader_ReadIDCard(Long ReaderHandle);
int PICC_Reader_ReadIDCard(Long ReaderHandle, byte[] response);
/** 以下函数须在 “PICC_Reader_ReadIDCard” 函数执行成功之后调用,否则获取不到有效信息 */
/**
@@ -287,99 +285,99 @@ public interface CardReaderSdk extends Library {
* 2港澳台居民居住证
* 4新外国人永久居留证
*/
Integer GetCardType();
int GetCardType();
/**
* 姓名(类型为 1 时表示:外国人中文姓名)
*/
Integer GetName(byte[] outParam);
int GetName(byte[] outParam);
/**
* 性别
*/
Integer GetSex(byte[] outParam);
int GetSex(byte[] outParam);
/**
* 民族
*/
Integer GetNation(byte[] outParam);
int GetNation(byte[] outParam);
/**
* 出生日期
*/
Integer GetBirth(byte[] outParam);
int GetBirth(byte[] outParam);
/**
* 住址
*/
Integer GetAddress(byte[] outParam);
int GetAddress(byte[] outParam);
/**
* 公民身份证号码(类型为 1时表示外国人居留证号码)
*/
Integer GetCertNo(byte[] outParam);
int GetCertNo(byte[] outParam);
/**
* 签发机关
*/
Integer GetDepartemt(byte[] outParam);
int GetDepartemt(byte[] outParam);
/**
* 有效起始日期
*/
Integer GetEffectDate(byte[] outParam);
int GetEffectDate(byte[] outParam);
/**
* 有效截止日期
*/
Integer GetExpireDate(byte[] outParam);
int GetExpireDate(byte[] outParam);
/**
* bmp 格式照片数据
*/
Integer GetBmpFileData(byte[] outParam);
int GetBmpFileData(byte[] outParam);
/**
* 生成照片
* TODO 入参参考文中3.4.1
*/
Integer GetBmpFile(byte[] outParam);
int GetBmpFile(byte[] outParam);
/**
* 是否含存在指纹信息:存在时返回 512 或者 1024
* 不存在时返回 0
*/
Integer IsFingerExist();
int IsFingerExist();
/**
* 获取指纹数据:成功时返回获取到的字节长度
*/
Integer GetFingerprint(byte[] outParam);
int GetFingerprint(byte[] outParam);
/**
* 外国人英文姓名
*/
Integer GetEnName(byte[] outParam);
int GetEnName(byte[] outParam);
/**
* 外国人国籍代码符合GB/T2659-2000规定
*/
Integer GetNationalityCode(byte[] outParam);
int GetNationalityCode(byte[] outParam);
/**
* 港澳台通行证号码
*/
Integer GetTXZHM(byte[] outParam);
int GetTXZHM(byte[] outParam);
/**
* 港澳台通行证签发次数
*/
Integer GetTXZQFCS(byte[] outParam);
int GetTXZQFCS(byte[] outParam);
/**
* 外国人换证次数
*/
Integer GetHZCS(byte[] outParam);
int GetHZCS(byte[] outParam);
/** ------------ 社保卡 ---------*/
/**
@@ -392,7 +390,7 @@ public interface CardReaderSdk extends Library {
* 4-自动寻卡,非接触式操作卡优先
* @return
*/
Long iReadCardBas(int iType, byte[] data);
int iReadCardBas(int iType, byte[] data);
/**
* 基于加密机的读基本信息(步骤一)
@@ -424,44 +422,8 @@ public interface CardReaderSdk extends Library {
}
private static String GetLibraryPath() {
// if (Platform.isWindows()) {
// return Platform.is64Bit() ? "/win32-x86-64/QXSSSE32_x64.dll" : "/win32-x86-64/QXSSSE32_x64.dll";
// } else if (Platform.isLinux()) {
// return Platform.is64Bit() ? "/win32-x86-64/QXSSSE32_x64.so" : "/win32-x86-64/QXSSSE32_x64.so";
// } else {
// return Platform.isMac() ? "/win32-x86-64/QXSSSE32_x64.so" : "/win32-x86-64/QXSSSE32_x64.so";
// }
return "/win32-x86-64/SSSE32.dll";
}
}
//社保卡
public int PICC_Reader_SSCardInfo1(Long ReaderHandle,
byte[] SBKH,
byte[] SHBZHM,
byte[] XM,
byte[] XB,
byte[] CSRQ
);
//身份证
public int PICC_Reader_ReadIDInfo(Long ReaderHandle,
String filepath,
byte[] pName,
byte[] pSex,
byte[] pNation,
byte[] pBirth,
byte[] pAddress,
byte[] pCertNo,
byte[] pDepartment ,
byte[] pEffectData,
byte[] pExpire,
byte[] pErrMsg);
public int ICC_SelscetScan(Long ReaderHandle, byte[] pCodeInfo , int [] lent);
public int iGetDevUID(byte[] pOutInfo);
}