|
@@ -500,7 +500,7 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
|
|
|
|
|
|
headPhotoTime.Clear();
|
|
|
frontPhotoTime.Clear();
|
|
|
- headPhotoTime.Clear();
|
|
|
+ backPhotoTime.Clear();
|
|
|
|
|
|
bool bExitWhenReading = false;
|
|
|
int curDeleteType = Bmp_ZP;
|
|
@@ -559,7 +559,7 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
|
|
|
else
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setLogCode(IDCertService_LogCode_IDCerAuthenticate).setCostTime(IDCerAuthenticateTime)();
|
|
|
+ .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
|
|
|
IDCerInfoEx2 idInfoEx2;
|
|
|
memset(&idInfoEx2, 0, sizeof(idInfoEx2));
|
|
@@ -584,14 +584,13 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
|
|
|
LogEvent(Severity_Middle, LOG_EVT_IDCERTIFICATE_OP, "IDCertifacate op.");
|
|
|
|
|
|
//转换数据并赋值至传出字段
|
|
|
- CopyTextIDCerDataToCtx(idInfoEx2, ctx);
|
|
|
- //转换头像图片
|
|
|
- GetPngBlobEx(ctx->Ans.headphoto, "zp");
|
|
|
- ctx->Ans.photodata = ctx->Ans.headphoto;
|
|
|
+ CopyIDCerDataToCtx(idInfoEx2, ctx);
|
|
|
+ ctx->Ans.photodata = ctx->Ans.headphoto; //现接口继续保持复制图片,待后续JS改造下掉photodata字段
|
|
|
+
|
|
|
ctx->Ans.hasscan = 0;
|
|
|
if (igestionVer == TRUE) //吸入式设备才调用正反扫描功能
|
|
|
{
|
|
|
- if (GetAndCheckScanImg(idInfoEx2, ctx->Ans.frontphoto, ctx->Ans.backphoto))
|
|
|
+ if (GetScanImg(idInfoEx2, ctx->Ans.frontphoto, ctx->Ans.backphoto))
|
|
|
{
|
|
|
curDeleteType = Bmp_ZP | Bmp_SCAN;
|
|
|
ctx->Ans.hasscan = 1;
|
|
@@ -667,21 +666,19 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
|
|
|
if (errAuth == Error_DevMedia)
|
|
|
{
|
|
|
LogWarn(Severity_Low, Error_Unexpect, IDCertificate_UserErrorCode_Timeout_OtherCard, "读证超时,插入的卡片非身份.");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(IDCertService_LogCode_IDCerAuthenticate)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
ctx->Answer(Error_TimeOut);
|
|
|
}
|
|
|
else if (errAuth == Error_Dev_IDCardNotFound)
|
|
|
{
|
|
|
LogWarn(Severity_Low, Error_Unexpect, IDCertificate_UserErrorCode_Timeout_NoCard, "读证超时,未检测到有卡片插入.");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(IDCertService_LogCode_IDCerAuthenticate)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
ctx->Answer(Error_TimeOut);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SetErrorAndLog(errAuth, MEC_DEVAPI_IDCER_IDCerAuthenticate_Error, "DevAdapter::IDCerAuthenticate", __FUNCTION__,
|
|
|
- false, IDCerAuthenticateTime, IDCertService_LogCode_IDCerAuthenticate); //RTA2116
|
|
|
+ false, IDCerAuthenticateTime); //RTA2116
|
|
|
ctx->Answer(Error_TimeOut, GetAlarmDEC());
|
|
|
}
|
|
|
}
|
|
@@ -772,7 +769,7 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
|
|
|
else
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setLogCode(IDCertService_LogCode_IDCerAuthenticate).setCostTime(IDCerAuthenticateTime)();
|
|
|
+ .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
|
|
|
IDCerInfoEx2 idInfoEx2;
|
|
|
memset(&idInfoEx2, 0, sizeof(idInfoEx2));
|
|
@@ -782,37 +779,27 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
|
|
|
m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
IDCerGetDataEx2Time = m_ullEndTime - m_ullBeginTime;
|
|
|
|
|
|
- if (errReadEx2 == Error_NotImpl)
|
|
|
+ //ex2数据读取功能代码、UCS2转UTF8代码
|
|
|
+ if (errReadEx2 == Error_Succeed)
|
|
|
{
|
|
|
- ctx->Ans.msgtype = 0; //旧字段传递,GBK、字符串传递文字信息
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ctx->Ans.msgtype = 1; //新字段传递,UTF8、二进制传递文字信息
|
|
|
- //ex2数据读取功能代码、UCS2转UTF8代码
|
|
|
- if (errReadEx2 == Error_Succeed)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER)
|
|
|
- .setAPI("DevAdapter::IDCerGetDataEx2").setLogCode(IDCertService_LogCode_IDCerGetDataEx2).setCostTime(IDCerGetDataEx2Time)();
|
|
|
- LogEvent(Severity_Middle, LOG_EVT_IDCERTIFICATE_OP, "IDCertifacate op.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER)
|
|
|
+ .setAPI("DevAdapter::IDCerGetDataEx2").setLogCode(IDCertService_LogCode_IDCerGetDataEx2).setCostTime(IDCerGetDataEx2Time)();
|
|
|
+ LogEvent(Severity_Middle, LOG_EVT_IDCERTIFICATE_OP, "IDCertifacate op.");
|
|
|
|
|
|
- //转换数据并赋值至传出字段
|
|
|
- CopyTextIDCerDataToCtx(idInfoEx2, ctx);
|
|
|
- //转换头像图片
|
|
|
- GetPngBlobEx(ctx->Ans.headphoto, "zp");
|
|
|
- ctx->Ans.photodata = ctx->Ans.headphoto;
|
|
|
- ctx->Ans.hasscan = 0;
|
|
|
- if (igestionVer == TRUE) //吸入式设备才调用正反扫描功能
|
|
|
+ //转换数据并赋值至传出字段
|
|
|
+ CopyIDCerDataToCtx(idInfoEx2, ctx);
|
|
|
+
|
|
|
+ ctx->Ans.hasscan = 0;
|
|
|
+ if (igestionVer == TRUE) //吸入式设备才调用正反扫描功能
|
|
|
+ {
|
|
|
+ if (GetScanImg(idInfoEx2, ctx->Ans.frontphoto, ctx->Ans.backphoto))
|
|
|
{
|
|
|
- if (GetAndCheckScanImg(idInfoEx2, ctx->Ans.frontphoto, ctx->Ans.backphoto))
|
|
|
- {
|
|
|
- curDeleteType = Bmp_ZP | Bmp_SCAN;
|
|
|
- ctx->Ans.hasscan = 1;
|
|
|
- }
|
|
|
+ curDeleteType = Bmp_ZP | Bmp_SCAN;
|
|
|
+ ctx->Ans.hasscan = 1;
|
|
|
}
|
|
|
- DeleteZP(curDeleteType, 2);
|
|
|
- break;
|
|
|
}
|
|
|
+ DeleteZP(curDeleteType, 2);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
dwEnd = SP::Module::Comm::RVCGetTickCount();
|
|
@@ -875,21 +862,19 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
|
|
|
if (errAuth == Error_DevMedia)
|
|
|
{
|
|
|
LogWarn(Severity_Low, Error_Unexpect, IDCertificate_UserErrorCode_Timeout_OtherCard, "读证超时,插入的卡片非身份.");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(IDCertService_LogCode_IDCerAuthenticate)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
ctx->Answer(Error_Unexpect, GetAlarmDEC(MEC_DEVAPI_IDCER_IDCerAuthenticate_NotIDCard)); //RTA2108
|
|
|
}
|
|
|
else if (errAuth == Error_Dev_IDCardNotFound)
|
|
|
{
|
|
|
LogWarn(Severity_Low, Error_Unexpect, IDCertificate_UserErrorCode_Timeout_NoCard, "读证超时,未检测到有卡片插入.");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(IDCertService_LogCode_IDCerAuthenticate)
|
|
|
- .setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::IDCerAuthenticate").setCostTime(IDCerAuthenticateTime)();
|
|
|
ctx->Answer(Error_Unexpect, GetAlarmDEC(MEC_DEVAPI_IDCER_IDCerAuthenticate_NoCard)); //RTA2107
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SetErrorAndLog(errAuth, MEC_DEVAPI_IDCER_IDCerAuthenticate_Error, "DevAdapter::IDCerAuthenticate", __FUNCTION__,
|
|
|
- false, IDCerAuthenticateTime, IDCertService_LogCode_IDCerAuthenticate); //RTA2116
|
|
|
+ false, IDCerAuthenticateTime); //RTA2116
|
|
|
ctx->Answer(Error_Unexpect, GetAlarmDEC());
|
|
|
}
|
|
|
}
|
|
@@ -1495,6 +1480,8 @@ void CIDCertFSM::CheckHanZi(UINT16* ucs2_code)
|
|
|
|
|
|
UINT16* tmp = ucs2_code;
|
|
|
int count = 1;
|
|
|
+
|
|
|
+ char* strFileHash = new char[4];
|
|
|
while (*tmp != '\0')
|
|
|
{
|
|
|
if (*tmp >= 0x4e00 && *tmp <= 0x9fa5)
|
|
@@ -1507,7 +1494,6 @@ void CIDCertFSM::CheckHanZi(UINT16* ucs2_code)
|
|
|
memset(fileHash, 0, 2);
|
|
|
memcpy(fileHash, tmp, 2);
|
|
|
|
|
|
- char* strFileHash = new char[4];
|
|
|
memset(strFileHash, 0, 4);
|
|
|
SP::Module::Util::HexBuf2StrBuf(fileHash, &strFileHash, 2);
|
|
|
|
|
@@ -1518,6 +1504,11 @@ void CIDCertFSM::CheckHanZi(UINT16* ucs2_code)
|
|
|
tmp++;
|
|
|
count++;
|
|
|
}
|
|
|
+ if (strFileHash != nullptr)
|
|
|
+ {
|
|
|
+ delete[] strFileHash;
|
|
|
+ strFileHash = nullptr;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
CSimpleStringA CIDCertFSM::GetFileHashStr(CSimpleStringA filePath)
|
|
@@ -1586,7 +1577,7 @@ CSimpleStringA CIDCertFSM::GetFileLastModifyTime(CSimpleStringA filePath)
|
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
|
-void CIDCertFSM::CopyTextIDCerDataToCtx(IDCerInfoEx2 idInfoEx2, T& ctx)
|
|
|
+void CIDCertFSM::CopyIDCerDataToCtx(IDCerInfoEx2 idInfoEx2, T& ctx)
|
|
|
{
|
|
|
IDCerTextData *utf8Data = new IDCerTextData();
|
|
|
memset(utf8Data, 0, sizeof(utf8Data));
|
|
@@ -1663,6 +1654,9 @@ void CIDCertFSM::CopyTextIDCerDataToCtx(IDCerInfoEx2 idInfoEx2, T& ctx)
|
|
|
memcpy(ctx->Ans.reserved_utf8.m_pData, utf8Data->reserved, strlen((char*)utf8Data->reserved)); //新外国人永居证关联字段
|
|
|
memcpy(ctx->Ans.othercode_utf8.m_pData, utf8Data->englishNameEx, strlen((char*)utf8Data->englishNameEx)); //英文名备用字段
|
|
|
|
|
|
+ //转换头像图片
|
|
|
+ GetPngBlobEx(ctx->Ans.headphoto, "zp");
|
|
|
+
|
|
|
if (utf8Data != nullptr)
|
|
|
{
|
|
|
delete utf8Data;
|
|
@@ -1683,7 +1677,7 @@ void CIDCertFSM::CopyTextIDCerDataToCtx(IDCerInfoEx2 idInfoEx2, T& ctx)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-BOOL CIDCertFSM::GetAndCheckScanImg(IDCerInfoEx2 idInfoEx2, CBlob& frontImg, CBlob& backImg)
|
|
|
+BOOL CIDCertFSM::GetScanImg(IDCerInfoEx2 idInfoEx2, CBlob& frontImg, CBlob& backImg)
|
|
|
{
|
|
|
BOOL resFlag = FALSE;
|
|
|
m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
|
|
@@ -1693,9 +1687,7 @@ BOOL CIDCertFSM::GetAndCheckScanImg(IDCerInfoEx2 idInfoEx2, CBlob& frontImg, CBl
|
|
|
|
|
|
if (eErr == Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::ScanIDAndSaveImage")
|
|
|
- .setLogCode(IDCertService_LogCode_ScanIDAndSaveImage)
|
|
|
- .setCostTime(ScanIDAndSaveImageTime)();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::ScanIDAndSaveImage").setCostTime(ScanIDAndSaveImageTime)();
|
|
|
|
|
|
transImgMsg.Clear();
|
|
|
//idfront.bmp" and "idback.bmp
|
|
@@ -1723,7 +1715,7 @@ BOOL CIDCertFSM::GetAndCheckScanImg(IDCerInfoEx2 idInfoEx2, CBlob& frontImg, CBl
|
|
|
backImgCheck->inNationality = GetGBKString((UINT16*)idInfoEx2.nationality.data);
|
|
|
backImgCheck->inIdType = GetGBKString((UINT16*)idInfoEx2.idType.data);
|
|
|
backImgCheck->imgInput = backImg;
|
|
|
- frontImgCheck->imgType = "背面";
|
|
|
+ backImgCheck->imgType = "背面";
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(backImgCheck);
|
|
|
}
|
|
|
#endif
|
|
@@ -1743,7 +1735,7 @@ BOOL CIDCertFSM::GetAndCheckScanImg(IDCerInfoEx2 idInfoEx2, CBlob& frontImg, CBl
|
|
|
{
|
|
|
if (eErr != Error_NotImpl)
|
|
|
SetErrorAndLog(eErr, MEC_DEVAPI_IDCER_ScanIDAndSaveImage, "DevAdapter::ScanIDAndSaveImage", __FUNCTION__,
|
|
|
- false, ScanIDAndSaveImageTime, IDCertService_LogCode_ScanIDAndSaveImage);
|
|
|
+ false, ScanIDAndSaveImageTime);
|
|
|
}
|
|
|
|
|
|
return resFlag;
|
|
@@ -1760,6 +1752,12 @@ char* CIDCertFSM::GetGBKString(UINT16* ucs2_code) //将UCS2字段转换为GBK,
|
|
|
gbkData = (char*)malloc((iSize + 1));
|
|
|
WideCharToMultiByte(CP_ACP, 0, (wchar_t*)ucs2_code, -1, gbkData, iSize, NULL, NULL);
|
|
|
|
|
|
+ if (tData != nullptr)
|
|
|
+ {
|
|
|
+ delete[] tData;
|
|
|
+ tData = nullptr;
|
|
|
+ }
|
|
|
+
|
|
|
return gbkData;
|
|
|
}
|
|
|
#endif // RVC_OS_WIN
|