Ver Fonte

Z991239-938 #comment fix: 时间函数处理

翟俊伟80258120 há 5 anos atrás
pai
commit
3a85059be5

+ 2 - 1
Module/mod_CustMngrAuth/CMakeLists.txt

@@ -16,12 +16,13 @@ BUILD missing)
 
 target_include_directories(${MODULE_NAME} PRIVATE
 	${RVC_COMMOM_INCLUDE_DIR}
+	${CONAN_RVCFRAMEWORK_ROOT}/include
 	${ModuleCommonHeadPath}
 	${MODULE_BASE_DIR}/mod_FingerPrint
 	${MODULE_BASE_DIR}/mod_DeviceControl
 	${MODULE_BASE_DIR}/mod_MaintainWatcher
 	${MODULE_BASE_DIR}/mod_BootManager
-	${CONAN_INCLUDE_DIRS_JSONCPP}/json
+	${CONAN_INCLUDE_DIRS_JSONCPP}
 )
 
 # 添加实体需要依赖的其他共享库(包括系统库):连接器包含的包

+ 13 - 19
Module/mod_CustMngrAuth/CustMngrAuthFSM.cpp

@@ -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;
 	}

+ 4 - 4
Module/mod_CustMngrAuth/CustMngrAuthFSM.h

@@ -3,13 +3,13 @@
 #define __CUSTMNGRAUTH_FSM_H
 
 #pragma once
-//#include "stdafx.h"
+
 #include "SpFSM.h"
 #include "SpSecureClient.h"
-#include "json.h"
+#include "json/json.h"
 
 #include "CustMngrAuth_server_g.h"
-#include "CustMngrAuth_msg_g.h" 
+#include "CustMngrAuth_msg_g.h"
 
 using namespace CustMngrAuth;
 
@@ -351,7 +351,7 @@ public:
 	bool ReadDataIntoMemory(bool& bHasData);
 	void UpdateDataIntoMemory(map<CSimpleStringA, FeatureData*> tempFeature, bool bIsFirstTimeQueryData);
 	string ClearStringSpaceHeadTail(string& line);
-	CSimpleStringA CCustMngrAuthFSM::GetCurrentDate();
+	CSimpleStringA GetCurrentDate();
 	void TransDataFromServer(CAutoArray<CSimpleStringA> &dataArray, CSimpleStringA latestTime, bool& bResumeTrans, bool bIsFirstTimeQueryData);
 	bool BackupFile(CSimpleStringA srcFile, CSimpleStringA dstFile);
 	CSimpleStringA GetMaxTime(CSimpleStringA maxTime, CSimpleStringA tempTime);

+ 1 - 7
Module/mod_CustMngrAuth/mod_CustMngrAuth.cpp

@@ -1,5 +1,4 @@
 #pragma once
-//#include "stdafx.h"
 
 #include "SpBase.h"
 #include "mod_CustMngrAuth.h"
@@ -96,7 +95,7 @@ void CCustMngrAuthEntity::OnBroadcastEvent(CUUID SubID, const char *pszEntityNam
 		{
 			MaintainWatcher::UkeyInsert ui;
 			SpBuffer2Object(Buffer, ui);
-			if (ui.UkeyID != NULL && strlen(ui.UkeyID)!=0)
+			if (!ui.UkeyID.IsNullOrEmpty() && strlen(ui.UkeyID)!=0)
 			{
 				Dbg("receive ukeyinsert event: UkeyID is %s", ui.UkeyID);
 				//先发消息再转状态,因为给前端发消息也属于工作中。
@@ -244,11 +243,6 @@ void CustMngrAuthServerSession::Handle_HoldOn(SpReqAnsContext<CustMngrAuthServic
 	m_pEntity->HoldOn(ctx);
 }
 
-
-
-
-
-
 SP_BEGIN_ENTITY_MAP()
 	SP_ENTITY(CCustMngrAuthEntity)
 SP_END_ENTITY_MAP()

+ 2 - 1
Module/mod_CustMngrAuth/mod_CustMngrAuth.h

@@ -1,7 +1,8 @@
 #ifndef MOD_CUSTMNGRAUTH_H
 #define MOD_CUSTMNGRAUTH_H
+
 #pragma once
-//#include "stdafx.h"
+
 #include "SpBase.h"
 #include "SpTest.h"