Browse Source

Z991239-4900 #comment 去除授权实体本地保存指纹比对代码

Signed-Off-By: commit-hook
刘文涛80174520 2 years ago
parent
commit
c8c43ca08e

+ 0 - 569
Module/mod_CustMngrAuth/CustMngrAuthFSM.cpp

@@ -1432,597 +1432,28 @@ ErrorCodeEnum CCustMngrAuthFSM::ConnectFingerPrintEntity()
 
 #pragma region update feature process
 
-void CCustMngrAuthFSM::FeatureUpdate()
-{
-	LOG_FUNCTION();
-	InitBeforeUpdateData();
-	int waitInternal = UPDATE_INTERNAL;
-
-	while (true)
-	{
-		do
-		{
-			int connectFailedTimes = 0;
-			m_pConnection = new FeatureUpdateConn(m_pEntity, this);
-
-			if (m_pConnection->ConnectFromCentralSetting() && m_pConnection->IsConnectionOK())
-			{
-				connectFailedTimes = 0;
-				waitInternal = UPDATE_INTERNAL;
-
-				ErrorCodeEnum errCode;
-				CSmartPointer<IConfigInfo> spConfig;
-				CAutoArray<CSimpleStringA> transArray;
-				RunInfoParams runInfoParam;
-				memset(&runInfoParam, 0, sizeof(runInfoParam));
-
-				errCode = InitBeforeQueryData(runInfoParam, spConfig);
-				if (errCode != Error_Succeed)
-					break;
-
-				errCode = ReceiveDataFromServer(transArray, runInfoParam);
-				if (errCode != Error_Succeed)
-					break;
-
-				errCode = BackupBeforeWriteData(runInfoParam, spConfig);
-				if (errCode != Error_Succeed)
-					break;
-
-				errCode = WriteData(runInfoParam, transArray, spConfig);
-				if (errCode != Error_Succeed)
-					break;
-			}
-			else {
-				connectFailedTimes++;
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("connect branchserver failed for %d times, try again in %d ms."
-					, connectFailedTimes, CONNECT_INTERNAL);
-
-				if (connectFailedTimes >= 60)
-				{
-					//30min give a warn
-					LogWarn(Severity_Middle, Error_Unexpect
-						, LOG_ERR_CUSTMNGRAUTH_FEATUPDATE_CONNECT_FAILED
-						, "Connect branch server failed.");
-					connectFailedTimes = 0;
-				}
-				waitInternal = CONNECT_INTERNAL;
-			}
-		} while (false);
-
-		if (m_pConnection)
-		{
-			m_pConnection->Close();
-			m_pConnection->DecRefCount();
-			m_pConnection = NULL;
-		}
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Feature-update processed, wait until next");
-		//wait for next query
-		if (WaitForSingleObject(hStopUpdate, waitInternal) == WAIT_OBJECT_0)
-			break;
-	}
-}
-
-CSimpleStringA CCustMngrAuthFSM::GetMaxTime(CSimpleStringA maxTime, CSimpleStringA tempTime)
-{
-	if (tempTime.GetLength() <= 0)
-		return maxTime;
-
-	if (maxTime.GetLength() <= 0)
-	{
-		maxTime = tempTime;
-	}
-	else {
-		int compareResult = CompareUpdateTime((const char*)maxTime, (const char*)tempTime);
-		if (compareResult == 0)
-		{
-			maxTime = tempTime;
-		}
-	}
-	return maxTime;
-}
-
-int CCustMngrAuthFSM::CompareUpdateTime(const char* time1, const char* time2)
-{
-	int year1, month1, day1, hour1, minute1, second1;
-	int year2, month2, day2, hour2, minute2, second2;
-
-	sscanf(time1, "%d-%d-%d %d:%d:%d", &year1, &month1, &day1, &hour1, &minute1, &second1);
-	sscanf(time2, "%d-%d-%d %d:%d:%d", &year2, &month2, &day2, &hour2, &minute2, &second2);
-
-	int tm1 = year1 * 10000 + month1 * 100 + day1;
-	int tm2 = year2 * 10000 + month2 * 100 + day2;
-	if (tm1 != tm2)
-		return (tm1 > tm2) ? 1 : 0;
-	tm1 = hour1 * 3600 + minute1 * 60 + second1;
-	tm2 = hour2 * 3600 + minute2 * 60 + second2;
-	if (tm1 != tm2)
-		return (tm1 > tm2) ? 1 : 0;
-	return 2;
-}
-
-CSimpleString CCustMngrAuthFSM::GenerateAlarmJson(CSimpleString entityName, int cost)
-{
-	return CSimpleString::Format("[{\"name\":\"%s\",\"cost\":%d}]"
-		, entityName.GetData(), cost);
-}
-
-string CCustMngrAuthFSM::ClearStringSpaceHeadTail(string& line)
-{
-	if (line.empty())
-		return line;
-
-	line.erase(0, line.find_first_not_of(" "));
-	line.erase(line.find_last_not_of(" ") + 1);
-
-	return line;
-}
-
-int CCustMngrAuthFSM::CompareTime(CSimpleStringA time1, CSimpleStringA time2)
-{
-	if (time1.GetLength() > 0 && time2.GetLength() > 0)
-	{
-		int year1 = atoi((const char*)time1.SubString(0, 4));
-		int month1 = atoi((const char*)time1.SubString(4, 2));
-		int day1 = atoi((const char*)time1.SubString(6, 2));
-
-		int year2 = atoi((const char*)time2.SubString(0, 4));
-		int month2 = atoi((const char*)time2.SubString(4, 2));
-		int day2 = atoi((const char*)time2.SubString(6, 2));
-
-		int temp1 = year1 * 10000 + month1 * 100 + day1;
-		int temp2 = year2 * 10000 + month2 * 100 + day2;
-
-		if (temp1 > temp2)
-			return 1;
-		else if (temp1 < temp2)
-			return -1;
-		else
-			return 0;
-	}
-	return 0;
-}
-
-CSimpleStringA CCustMngrAuthFSM::GetCurrentDate()
-{
-	time_t curTime = time(NULL);
-	tm* p = localtime(&curTime);
-	char cTime[100] = { 0 };
-
-#ifdef RVC_OS_WIN
-	_snprintf_s(cTime, 100, "%d%02d%02d", p->tm_year + 1900, p->tm_mon + 1, p->tm_mday);
-#else
-	snprintf(cTime, 100, "%d%02d%02d", p->tm_year + 1900, p->tm_mon + 1, p->tm_mday);
-#endif // RVC_OS_WIN
-
-	CSimpleStringA curDate(cTime);
-	return curDate;
-}
-
-bool CCustMngrAuthFSM::BackupFile(CSimpleStringA srcFile, CSimpleStringA dstFile)
-{
-	if (!ExistsFile(srcFile.GetData()))
-		return true;
-
-	int result = fileutil_copy_file(dstFile.GetData(), srcFile.GetData());
-
-	return (result == 0) ? true : false;
-}
-
-void CCustMngrAuthFSM::UpdateDataIntoMemory(map<CSimpleStringA, FeatureData*> tempFeature, bool bIsFirstTimeQueryData)
-{
-	if (!bIsFirstTimeQueryData)
-	{
-		for (auto it = tempFeature.begin(); it != tempFeature.end(); ++it) {
-			if (m_featureData.find(it->first) == m_featureData.end()) {//if not exist,insert immediately
-				m_featureData[it->first] = it->second;
-			}
-			else {//if exist already, release memory first, then insert
-				auto tempFD = m_featureData[it->first];
-				m_featureData[it->first] = it->second;
-				if (tempFD != NULL) { delete tempFD; tempFD = NULL; }
-			}
-		}
-	}
-	else {
-		for (auto iter = m_featureData.begin(); iter != m_featureData.end();) {
-			auto fd = iter->second;
-			if (fd) { delete fd; fd = NULL; m_featureData.erase(iter++); }
-		}
-		m_featureData.insert(tempFeature.begin(), tempFeature.end());
-	}
-}
-
-bool CCustMngrAuthFSM::ReadDataIntoMemory(bool& bHasData)
-{
-	LOG_FUNCTION();
-
-	CSimpleStringA runInfoFile(true);
-	runInfoFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth.ini"
-		, m_RunInfoPath.GetData());
-	std::ifstream inFile(runInfoFile.GetData());
-	string line;
-	int customerNum = 0;
-
-	ULLINT startReadFile = RVCGetTickCount();
-	ULLINT endReadFile = RVCGetTickCount();
-
-	while (getline(inFile, line))
-	{
-		if (line.length() <= 0)
-			continue;
-
-		string tempLine = ClearStringSpaceHeadTail(line);
-		if (!tempLine.compare("[UpdateTime]") || string::npos != tempLine.find("UpdateTime")
-			|| !tempLine.compare("[LatestTime]") || string::npos != tempLine.find("LatestTime")
-			|| !tempLine.compare("[FingerInfo]") || !tempLine.compare("[FaceInfo]")
-			|| string::npos != tempLine.find("FaceInfo1") || string::npos != tempLine.find("FaceInfo2"))
-		{
-			continue;
-		}
-		string::size_type pos = tempLine.find("=");
-		if (pos != 16)
-			continue;
-
-		string keys = tempLine.substr(0, pos);
-		string values = tempLine.substr(pos + 1);
-
-		Json::Reader reader;
-		Json::Value root;
-		if (reader.parse((const char*)values.c_str(), root))
-		{
-			customerNum++;
-			FeatureData* fd = new FeatureData();
-			fd->FingerIDArray.Init(FINGER_NUM);
-			fd->FingerIDLenArray.Init(FINGER_NUM);
-			char index[20];
-			for (int i = 0; i < FINGER_NUM; ++i)
-			{
-				memset(index, 0, sizeof(index));
-#ifdef RVC_OS_WIN
-				_snprintf_s(index, 10, "FingerID%d", i + 1);
-#else
-				snprintf(index, 10, "FingerID%d", i + 1);
-#endif // RVC_OS_WIN
-
-				fd->FingerIDArray[i] = root.isMember(index) ? CSimpleStringA(root[index].asCString()) : "";
-				fd->FingerIDLenArray[i] = root.isMember(index) ? fd->FingerIDArray[i].GetLength() : 0;
-			}
-			m_featureData[CSimpleStringA(keys.c_str())] = fd;
-		}
-		else {
-			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Error: parse jsonFingerInfo failed.");
-			LogWarn(Severity_Middle, Error_Unexpect
-				, LOG_ERR_CUSTMNGRAUTH_AUTHORIZATION_READFEAT_FAILED
-				, "Read fingerprint feature json failed.");
-			return false;
-		}
-	}
-
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Total CustomerNum:%d in local file.", customerNum);
-
-	endReadFile = RVCGetTickCount();
-	ULLINT duration = endReadFile - startReadFile;
-	LogWarn(Severity_Middle, Error_Debug
-		, LOG_ERR_CUSTMNGRAUTH_READ_INTO_MEMORY_TIME
-		, GenerateAlarmJson("CustMngrAuth", duration).GetData());
-	bHasData = true;
-
-	return true;
-}
-
-
-void CCustMngrAuthFSM::InitBeforeUpdateData()
-{
-	bool bHasData = false;
-	bool bReadResult = ReadDataIntoMemory(bHasData);
-	if (bReadResult && bHasData)
-	{
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Read feature data into memory success.");
-	}
-	else if (bReadResult && !bHasData) {
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Has no data in local file.");
-	}
-	else {
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Read feature data into memory failed, wait next read.");
-	}
-}
-
-ErrorCodeEnum CCustMngrAuthFSM::InitBeforeQueryData(RunInfoParams& runInfoParam, CSmartPointer<IConfigInfo>& spConfig)
-{
-	ErrorCodeEnum errCode = Error_Succeed;
-
-	EnterCriticalSection(&m_cs);//临时锁一下运行时,防止在写入
-
-	errCode = LoadRunConfig(spConfig);
-	if (Error_Succeed != errCode)
-	{
-		LeaveCriticalSection(&m_cs);
-		return errCode;
-	}
 
-	InitTimeParams(runInfoParam, spConfig);
-	LeaveCriticalSection(&m_cs);
 
-	return errCode;
-}
 
-ErrorCodeEnum CCustMngrAuthFSM::LoadRunConfig(CSmartPointer<IConfigInfo>& spConfig)
-{
-	ErrorCodeEnum errCode = Error_Succeed;
 
-	errCode = GetEntityBase()->GetFunction()->OpenConfig(Config_Run, spConfig);
 
-	if (errCode != Error_Succeed)
-	{
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Open runcfg file failed before query data.");
-		LogError(Severity_High, Error_Unexpect
-			, LOG_ERR_CUSTMNGRAUTH_OPEN_RUNINFO_FAILED_UPDATE
-			, "open runcfg failed before query data.");
-	}
-	return errCode;
-}
 
-void CCustMngrAuthFSM::InitTimeParams(RunInfoParams& runInfoParam, CSmartPointer<IConfigInfo>& spConfig)
-{
-	ErrorCodeEnum errCode = Error_Succeed;
 
-	runInfoParam.LatestTime = "";
-	runInfoParam.UpdateTime = "";
-	CSimpleStringA latestTime(""), updateTime("");
-	spConfig->ReadConfigValue("LatestTime", "LatestTime", latestTime);
-	spConfig->ReadConfigValue("UpdateTime", "UpdateTime", updateTime);
-
-	//query current time
-	CSimpleStringA newTime = GetCurrentDate();
-	runInfoParam.UpdateTime = newTime;
-	runInfoParam.LatestTime = latestTime;
-
-	//当前日期大于文件中日期时,需要做全量更新
-	if (updateTime.GetLength() <= 0
-		|| (updateTime.GetLength() > 0 && CompareTime(newTime, updateTime) > 0)
-		|| latestTime.GetLength() <= 0)
-	{
-		runInfoParam.IsFirstTimeQueryData = true;
-	}
-}
 
-ErrorCodeEnum CCustMngrAuthFSM::ReceiveDataFromServer(CAutoArray<CSimpleStringA>& dataArray, RunInfoParams runInfoParam)
-{
-	LOG_FUNCTION();
-	char currAgent[16];
-	char branchID[16];
-	memset(currAgent, 0, sizeof(currAgent));
-	memset(branchID, 0, sizeof(currAgent));
-	bool bResumeTrans = true;
-	ErrorCodeEnum errCode = Error_Unexpect;
-
-	while (bResumeTrans)
-	{
-		if (runInfoParam.IsFirstTimeQueryData)
-			m_pConnection->SendFeatReq(currAgent, branchID);
-		else
-			m_pConnection->SendFeatReq(currAgent, branchID, runInfoParam.LatestTime.GetData());
 
-		ResetEvent(m_pConnection->m_hPkgAnswer);
 
-		DWORD dw = WaitForSingleObject(m_pConnection->m_hPkgAnswer, 20000); //10->20  20200430@liuwentao
-		switch (dw)
-		{
-		case WAIT_FAILED:
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_FAILED!");
-			break;
-		case WAIT_TIMEOUT:
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_TIMEOUT");
-		case WAIT_OBJECT_0:
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_OBJECT_0");
-			break;
-		}
-		ResetEvent(m_pConnection->m_hPkgAnswer);
 
-		if (m_pConnection->m_reply == NULL)
-		{
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_reply still null after m_hPkgAnswer handled");
-			break;
-		}
-		if (m_pConnection->m_GetErrMsg)
-		{
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get error message, check dbg log");
-			break;
-		}
-		if (m_pConnection->m_reply->ResultCode == 2)
-		{
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("remote server uninitialized yet, unable to excute query");
-			break;
-		}
-		else {
-			if (m_pConnection->m_reply->ResultCode == 0)
-			{
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("All package downloaded from branch server.");
-				bResumeTrans = false;
-				errCode = Error_Succeed;
-			}
-			memcpy(currAgent, m_pConnection->m_reply->CurrentAgent, 16);
-			memcpy(branchID, m_pConnection->m_reply->BranchID, 16);
-			CSimpleStringA jbuf(m_pConnection->m_reply->Data, m_pConnection->m_jsonLen);
-			dataArray.Append(&jbuf, 0, 1);
-		}
-	}
 
-	if (bResumeTrans)
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("some errors happened, check the related log");
 
-	if (dataArray.GetCount() <= 0)
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("query no data from branchServer.");
 
-	return errCode;
-}
-
-ErrorCodeEnum CCustMngrAuthFSM::BackupBeforeWriteData(RunInfoParams& runInfoParam, CSmartPointer<IConfigInfo>& spConfig)
-{
-	LOG_FUNCTION();
-	ErrorCodeEnum errCode = Error_Succeed;
 
-	runInfoParam.SrcFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth.ini"
-		, m_RunInfoPath.GetData());
-	runInfoParam.BackupFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "runcfg" SPLIT_SLASH_STR "CustMngrAuth_bak.ini"
-		, m_RunInfoPath.GetData());
 
-	EnterCriticalSection(&m_cs);
-	if (!BackupFile(runInfoParam.SrcFile, runInfoParam.BackupFile))
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Backup runinfo file failed.");
 
-	if (runInfoParam.IsFirstTimeQueryData)
-	{
-		//首次更新,需清除数据,全量写入,并更新时间
-		ofstream fileOut((const char*)runInfoParam.SrcFile, ios::trunc);
-		fileOut.close();
-	}
 
-	errCode = GetEntityBase()->GetFunction()->OpenConfig(Config_Run, spConfig);
-	if (errCode != Error_Succeed)
-	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("error: open runcfg failed with errCode(%s)", SpStrError(errCode));
-		BackupFile(runInfoParam.BackupFile, runInfoParam.SrcFile);// if backup fail, recover
-		LeaveCriticalSection(&m_cs);
-	}
 
-	spConfig->WriteConfigValue("UpdateTime", "UpdateTime", runInfoParam.UpdateTime.GetData());
-	if (runInfoParam.IsFirstTimeQueryData)
-	{
-		spConfig->WriteConfigValue("LatestTime", "LatestTime", "");
-	}
-	return errCode;
-}
 
-ErrorCodeEnum CCustMngrAuthFSM::WriteData(RunInfoParams& runInfoParam, CAutoArray<CSimpleStringA> dataArray, CSmartPointer<IConfigInfo>& spConfig)
-{
-	ErrorCodeEnum errCode = Error_Unexpect;
 
-	TempFeatureData tmpFeatureData;
-	tmpFeatureData.MaxUpdateTime = runInfoParam.LatestTime;
-	bool bExitLoop = false;
 
-	for (int transTime = 0; transTime < dataArray.GetCount(); ++transTime)
-	{
-		Json::Value root;
-		Json::Reader reader;
-
-		//only 3-4 data, cause the limit of transfer amount
-		CSimpleStringA transBuffer = dataArray[transTime];
-		if (reader.parse(transBuffer.GetData(), root))
-		{
-			for (int i = 0; i < (int)root.size(); ++i)
-			{
-				JsonParams jsonParam;
-				jsonParam.Root = root;
-				jsonParam.Index = i;
-				errCode = ProcessFeatureData(jsonParam, tmpFeatureData, runInfoParam, spConfig);
-				if (Error_Succeed != errCode)
-				{
-					bExitLoop = true;
-					break;
-				}
-			}
-			if (bExitLoop)
-				break;
-		}
-		else {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("fail to parse transArray[%d]!", transTime);
-			LeaveCriticalSection(&m_cs);
-			bExitLoop = true;
-			break;
-		}
-	}
-	if (bExitLoop)
-		return Error_Unexpect;
-
-	if (tmpFeatureData.MaxUpdateTime.GetLength() > 0)
-	{
-		spConfig->WriteConfigValue("LatestTime", "LatestTime"
-			, tmpFeatureData.MaxUpdateTime.GetData());
-	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("updateNum=%d", tmpFeatureData.tmpFeatureMap.size());
-
-	UpdateDataIntoMemory(tmpFeatureData.tmpFeatureMap, runInfoParam.IsFirstTimeQueryData);
-	LeaveCriticalSection(&m_cs);
-
-	return Error_Succeed;
-}
-
-ErrorCodeEnum CCustMngrAuthFSM::ProcessFeatureData(JsonParams& jsonParam, TempFeatureData& tmpFeatureData, RunInfoParams runinfoParam, CSmartPointer<IConfigInfo>& spConfig)
-{
-	ErrorCodeEnum errCode = Error_Succeed;
-	FeatureData* fd = new FeatureData();
-	fd->FingerIDArray.Init(FINGER_NUM);
-	fd->FingerIDLenArray.Init(FINGER_NUM);
-	char FingerID[20];//runinfo file is named "FingerID"
-	char fingerId[20];//branchserver is named "fingerId" , history bug
-
-	for (int fingerIndex = 0; fingerIndex < FINGER_NUM; ++fingerIndex)
-	{
-		ZeroMemory(FingerID, sizeof(FingerID));
-		ZeroMemory(fingerId, sizeof(fingerId));
-#ifdef RVC_OS_WIN
-		_snprintf_s(FingerID, 10, "FingerID%d", fingerIndex + 1);
-		_snprintf_s(fingerId, 10, "fingerId%d", fingerIndex + 1);
-#else
-		snprintf(FingerID, 10, "FingerID%d", fingerIndex + 1);
-		snprintf(fingerId, 10, "fingerId%d", fingerIndex + 1);
-#endif // RVC_OS_WIN
-		jsonParam.FingerInfo[FingerID] = jsonParam.Root[jsonParam.Index][fingerId].asCString();
-		fd->FingerIDArray[fingerIndex] = CSimpleStringA(jsonParam.Root[jsonParam.Index][fingerId].asCString());
-		fd->FingerIDLenArray[fingerIndex] = fd->FingerIDArray[fingerIndex].GetLength();
-	}
-
-	CSimpleStringA customerID = CSimpleStringA(jsonParam.Root[jsonParam.Index]["customerID"].asCString());
-	if (tmpFeatureData.tmpFeatureMap.find(customerID) == tmpFeatureData.tmpFeatureMap.end())
-	{
-		// if not exist , insert directly
-		tmpFeatureData.tmpFeatureMap[customerID] = fd;
-	}
-	else {
-		auto tempFD = tmpFeatureData.tmpFeatureMap[customerID];
-		tmpFeatureData.tmpFeatureMap[customerID] = fd;
-		if (tempFD)
-		{
-			delete tempFD;
-			tempFD = NULL;
-		}
-	}
-	CSimpleStringA tempMaxUpdateTime = CSimpleStringA(jsonParam.Root[jsonParam.Index]["updateTime"].asCString());
-	tmpFeatureData.MaxUpdateTime = GetMaxTime(tmpFeatureData.MaxUpdateTime, tempMaxUpdateTime);
-
-	int fingerDataState = jsonParam.Root[jsonParam.Index]["state"].asCString()[0] - '0';
-	if (fingerDataState == 0)
-	{
-		Json::FastWriter writer;
-		CSimpleStringA jsonFingerStr(writer.write(jsonParam.FingerInfo).c_str());
-		int jlen = jsonFingerStr.GetLength() - 1;
-		char* jstr = new char[jlen + 1];
-		memcpy(jstr, jsonFingerStr.GetData(), jlen);
-		jstr[jlen] = '\0'; //in case no \n in the end
-
-		errCode = spConfig->WriteConfigValue(m_FingerSection.GetData(), customerID.GetData(), jstr);
-		delete[] jstr;
-
-		if (errCode != Error_Succeed)
-		{
-			BackupFile(runinfoParam.BackupFile, runinfoParam.SrcFile);
-			LeaveCriticalSection(&m_cs);
-			errCode = Error_Unexpect;
-		}
-	}
-	else if (fingerDataState == 2)
-	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("state(2): customer %s is currently unavailable.", customerID.GetData());
-		spConfig->WriteConfigValue((const char*)m_FingerSection, customerID.GetData(), "");
-	}
-	else {
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unexpected customer(%s)'s state is either 0 or 2", customerID.GetData());
-	}
-
-	return errCode;
-}
 
 
 #pragma endregion

+ 10 - 2
Module/mod_CustMngrAuth/CustMngrAuthFSM.h

@@ -6,13 +6,21 @@
 #include "stdafx.h"
 #include "SpFSM.h"
 #include "SpSecureClient.h"
-#include "json/json.h"
+
 
 #include "CustMngrAuth_server_g.h"
 #include "CustMngrAuth_msg_g.h"
+#ifdef RVC_OS_WIN
+#include "json.h"
+#include "..\mod_fingerprint\FingerPrint_client_g.h"
+#include "..\mod_DeviceControl\DeviceControl_client_g.h"
+#else
+#include "json/json.h"
 #include "FingerPrint_client_g.h"
 #include "DeviceControl_client_g.h"
 #include "CommEntityUtil.hpp"
+#endif
+
 
 using namespace CustMngrAuth;
 
@@ -842,7 +850,7 @@ struct FeatureUpdateTask : public ITaskSp
 	void Process()
 	{
 		LOG_FUNCTION();
-		fsm->FeatureUpdate();
+		//fsm->FeatureUpdate();
 	}
 };
 

+ 0 - 21
Module/mod_CustMngrAuth/test/TestCustMngrAuthEntity.cpp

@@ -12,24 +12,3 @@ TEST_CASE_FSM_CLASS(CCustMngrAuthFSM, "ReadDataIntoMemory")
 {
 	return Error_Succeed;
 }
-
-TEST_CASE_FSM_CLASS(CCustMngrAuthFSM, "BackupFile")
-{
-	CSimpleStringA srcFile = "file.ini";
-	CSimpleStringA dstFile = "file_bak.ini";
-	CSimpleStringA depPath;
-	m_pEntity->GetFunction()->GetPath("Dep", depPath);
-	srcFile = CSimpleStringA::Format("%s\\%s", depPath.GetData(), srcFile.GetData());
-	dstFile = CSimpleStringA::Format("%s\\%s", depPath.GetData(), dstFile.GetData());
-	bool result = BackupFile(srcFile, dstFile);
-
-	return result == true ? Error_Succeed : Error_Unexpect;
-}
-
-TEST_CASE_FSM_CLASS(CCustMngrAuthFSM, "ConnectFingerPrintEntity")
-{
-	LOG_FUNCTION();
-	ErrorCodeEnum errCode = ConnectFingerPrintEntity();
-	
-	return errCode;
-}

+ 0 - 6
Module/mod_FingerPrint/test/testFingerPrintEntity.cpp

@@ -68,13 +68,7 @@ TEST_CASE_FSM_CLASS(CFingerPrintFSM, "GetDevCatInfo")
 	return Error_Succeed;
 }
 
-TEST_CASE_FSM_CLASS(CFingerPrintFSM, "GenerateAlarmJson")
-{
-	CSimpleStringA result = GenerateAlarmJson("FingerPrint", 100);
 
-	Dbg("alarm result = %s", result.GetData());
-	return Error_Succeed;
-}
 
 TEST_CASE_METHOD("TestForRVCGetTickCount")
 {