|
@@ -1,21 +1,23 @@
|
|
|
-//#include "stdafx.h"
|
|
|
#include "SpBase.h"
|
|
|
#include "SpHelper.h"
|
|
|
+#include "path.h"
|
|
|
#include "CustMngrAuth_UserErrorCode.h"
|
|
|
#include "CustMngrAuthFSM.h"
|
|
|
#include <iostream>
|
|
|
#include <fstream>
|
|
|
+#include <sstream>
|
|
|
#include <map>
|
|
|
+#include <cstdio>
|
|
|
+#include <memory>
|
|
|
#include <iomanip>
|
|
|
#include <random>
|
|
|
#include <stdint.h>
|
|
|
-#include <sstream>
|
|
|
#include <thread>
|
|
|
#include <chrono>
|
|
|
-#include <time.h>
|
|
|
-#include "path.h"
|
|
|
+#include <ctime>
|
|
|
|
|
|
using namespace std;
|
|
|
+
|
|
|
#define _ATL_NO_AUTOMATIC_NAMESPACE
|
|
|
//#include <atltime.h>
|
|
|
|
|
@@ -385,8 +387,8 @@ bool CCustMngrAuthFSM::ReadDataIntoMemory(bool& bHasData)
|
|
|
|
|
|
Dbg("read data timer start...");
|
|
|
|
|
|
- clock_t startReadFile, endReadFile;
|
|
|
- startReadFile = clock();
|
|
|
+ clock_t startReadFile = clock();
|
|
|
+ clock_t endReadFile = clock();
|
|
|
|
|
|
while(getline(inFile, line)){
|
|
|
if(line.length() <= 0){
|
|
@@ -508,7 +510,8 @@ bool CCustMngrAuthFSM::BackupFile(CSimpleStringA srcFile, CSimpleStringA dstFile
|
|
|
}
|
|
|
fileExist.close();
|
|
|
inFile.open((const char*)srcFile);
|
|
|
- if (inFile.fail()){
|
|
|
+ if (inFile.fail())
|
|
|
+ {
|
|
|
Dbg("Open CustMngrAuth.ini failed");
|
|
|
inFile.close();
|
|
|
return false;
|
|
@@ -742,7 +745,6 @@ void CCustMngrAuthFSM::UpdateDataIntoMemory(map<CSimpleStringA, FeatureData*> te
|
|
|
}
|
|
|
}
|
|
|
}else{//如果是全量更新,需要先将内存数据清理掉,内存中有可能存在已离职人员
|
|
|
- DWORD dwStart = GetTickCount();
|
|
|
for(auto iter = m_featureData.begin(); iter != m_featureData.end();){
|
|
|
auto fd = iter->second;
|
|
|
if(fd){
|
|
@@ -752,8 +754,6 @@ void CCustMngrAuthFSM::UpdateDataIntoMemory(map<CSimpleStringA, FeatureData*> te
|
|
|
}
|
|
|
}
|
|
|
m_featureData.insert(tempFeature.begin(), tempFeature.end());
|
|
|
- DWORD dwEnd = GetTickCount();
|
|
|
- Dbg("copy data to memory time:%dms", dwEnd - dwStart);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -791,7 +791,6 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrint(SpReqAnsContext<CustMngrAuthSer
|
|
|
|
|
|
Dbg("begin copy feature to reqParams");
|
|
|
int i = 0, j = 0;
|
|
|
- DWORD dwStart = GetTickCount();
|
|
|
int count = 0; //实际不为空的指纹模板总个数
|
|
|
for (auto it = m_featureData.begin(); it != m_featureData.end(); ++it){
|
|
|
int countPerCust = 0;//统计每个CustomerID不为空指纹个数
|
|
@@ -827,8 +826,6 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrint(SpReqAnsContext<CustMngrAuthSer
|
|
|
matchReq.templateLen[i] = tempFeatureLenArray[i];
|
|
|
}
|
|
|
|
|
|
- DWORD dwEnd = GetTickCount();
|
|
|
- Dbg("copy data to match req, cost time:%dms", dwEnd - dwStart);
|
|
|
Dbg("end copy feature to reqParams");
|
|
|
Dbg("templateNum: %d", matchReq.templateNum);
|
|
|
|
|
@@ -839,12 +836,8 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrint(SpReqAnsContext<CustMngrAuthSer
|
|
|
}
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
//Sleep(100);//如果指纹仪返回及时,这里可以考虑去掉
|
|
|
- DWORD startMatch, endMatch;
|
|
|
- startMatch = GetTickCount();
|
|
|
Dbg("begin next invoke match.");
|
|
|
eErr = m_pFingerPrint->Match(matchReq, matchAns, 20000);
|
|
|
- endMatch = GetTickCount();
|
|
|
- Dbg("MatchTime:%d", endMatch - startMatch);
|
|
|
|
|
|
if (m_bCancelAuthorize || eErr == Error_Cancel){
|
|
|
bStopAuthorize = true;
|
|
@@ -1173,7 +1166,7 @@ ErrorCodeEnum CCustMngrAuthFSM::GetImgBlob(CBlob &data, CSimpleStringA imgPath)
|
|
|
{
|
|
|
Dbg("########Openning imgpath: %s", (const char*)imgPath);
|
|
|
ErrorCodeEnum eErr;
|
|
|
- FILE *fp = fopen(imgPath, "rb");
|
|
|
+ FILE* fp = fopen(imgPath, "rb");
|
|
|
if (fp) {
|
|
|
Dbg("fopen succeed.");
|
|
|
fseek(fp, 0, SEEK_END);
|
|
@@ -1183,7 +1176,8 @@ ErrorCodeEnum CCustMngrAuthFSM::GetImgBlob(CBlob &data, CSimpleStringA imgPath)
|
|
|
fread(data.m_pData, 1, flen, fp);
|
|
|
fclose(fp);
|
|
|
eErr = Error_Succeed;
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ else {
|
|
|
Dbg("fopen %s failed!", (LPCSTR)imgPath);
|
|
|
eErr = Error_IO;
|
|
|
}
|