|
@@ -4,6 +4,7 @@
|
|
|
#include "CustMngrAuth_UserErrorCode.h"
|
|
|
#include "CustMngrAuthFSM.h"
|
|
|
#include "CommEntityUtil.hpp"
|
|
|
+#include "fileutil.h"
|
|
|
|
|
|
#include <fstream>
|
|
|
#include <map>
|
|
@@ -587,9 +588,24 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintInfo(SpReqAnsContext<CustMngrA
|
|
|
ctx->Ans.feature = GetFingerAns.feature;
|
|
|
|
|
|
CBlob data;
|
|
|
- CSimpleStringA depPath(true);
|
|
|
+ CSimpleStringA depPath(true), depOldPath;
|
|
|
m_pEntity->GetFunction()->GetPath("Dep", depPath);
|
|
|
CSimpleStringA imgFullPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", depPath.GetData(), GetFingerAns.imageName.GetData());
|
|
|
+
|
|
|
+ if (!ExistsFileA(imgFullPath.GetData()))
|
|
|
+ {
|
|
|
+ ErrorCodeEnum eErrOld = m_pEntity->GetFunction()->GetPath("DepBak", depOldPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[DepBak]%s,%s", SpStrError(eErrOld), depOldPath.GetData());
|
|
|
+ depOldPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", depOldPath.GetData(), GetFingerAns.imageName.GetData());
|
|
|
+
|
|
|
+ if (ExistsFileA(depOldPath.GetData())) //在旧Dep路径下找到文件时告警
|
|
|
+ {
|
|
|
+ imgFullPath = depOldPath;
|
|
|
+ CSimpleStringA warnMsg = CSimpleStringA::Format("Find %s in OLD dep path!", depOldPath.GetData());
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_FindFile_in_DepBak, warnMsg.GetData());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ErrorCodeEnum imgErrCode = GetImgBlob(data, imgFullPath);
|
|
|
if (imgErrCode != Error_Succeed)
|
|
|
{
|
|
@@ -806,9 +822,22 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrintEx(SpReqAnsContext<CustMngrAuthS
|
|
|
ctx->Ans.Feature = GetFingerAns.feature;
|
|
|
|
|
|
CBlob data;
|
|
|
- CSimpleStringA depPath(true);
|
|
|
+ CSimpleStringA depPath(true), depOldPath;
|
|
|
m_pEntity->GetFunction()->GetPath("Dep", depPath);
|
|
|
CSimpleStringA imgFullPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", depPath.GetData(), GetFingerAns.imageName.GetData());
|
|
|
+ if (!ExistsFileA(imgFullPath.GetData()))
|
|
|
+ {
|
|
|
+ ErrorCodeEnum eErrOld = m_pEntity->GetFunction()->GetPath("DepBak", depOldPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[DepBak]%s,%s", SpStrError(eErrOld), depOldPath.GetData());
|
|
|
+ depOldPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", depOldPath.GetData(), GetFingerAns.imageName.GetData());
|
|
|
+
|
|
|
+ if (ExistsFileA(depOldPath.GetData())) //在旧Dep路径下找到文件时告警
|
|
|
+ {
|
|
|
+ imgFullPath = depOldPath;
|
|
|
+ CSimpleStringA warnMsg = CSimpleStringA::Format("Find %s in OLD dep path!", depOldPath.GetData());
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_FindFile_in_DepBak, warnMsg.GetData());
|
|
|
+ }
|
|
|
+ }
|
|
|
ErrorCodeEnum imgErrCode = GetImgBlob(data, imgFullPath);
|
|
|
if (imgErrCode != Error_Succeed)
|
|
|
{
|
|
@@ -853,9 +882,24 @@ ErrorCodeEnum CCustMngrAuthFSM::DeleteFileIfExisted(const char* fileName)
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Invalid or empty filename(%s)", fileName);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
- CSimpleStringA strPath, strObjPath;
|
|
|
+ CSimpleStringA strPath, strOldPath, strObjPath;
|
|
|
ErrorCodeEnum errCode = m_pEntity->GetFunction()->GetPath("Dep", strPath);
|
|
|
strObjPath = strPath + "\\" + fileName;
|
|
|
+
|
|
|
+ if (!ExistsFileA(strObjPath.GetData()))
|
|
|
+ {
|
|
|
+ ErrorCodeEnum eErrOld = m_pEntity->GetFunction()->GetPath("DepBak", strOldPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[DepBak]%s,%s", SpStrError(eErrOld), strOldPath.GetData());
|
|
|
+ strOldPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", strOldPath.GetData(), fileName);
|
|
|
+
|
|
|
+ if (ExistsFileA(strOldPath.GetData())) //在旧Dep路径下找到文件时告警
|
|
|
+ {
|
|
|
+ strObjPath = strOldPath;
|
|
|
+ CSimpleStringA warnMsg = CSimpleStringA::Format("Find %s in OLD dep path!", strOldPath.GetData());
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_FindFile_in_DepBak, warnMsg.GetData());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
WIN32_FIND_DATA findData;
|
|
|
if (FindFirstFileA((LPCTSTR)strObjPath, &findData) != INVALID_HANDLE_VALUE)
|
|
|
{
|
|
@@ -882,10 +926,24 @@ ErrorCodeEnum CCustMngrAuthFSM::DeleteFileIfExisted(const char* fileName)
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Invalid or empty filename(%s)", fileName);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
- CSimpleStringA strPath, strObjPath;
|
|
|
+ CSimpleStringA strPath, strOldPath, strObjPath;
|
|
|
ErrorCodeEnum errCode = m_pEntity->GetFunction()->GetPath("Dep", strPath);
|
|
|
strObjPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", strPath.GetData(), fileName);
|
|
|
|
|
|
+ if (!ExistsFileA(strObjPath.GetData()))
|
|
|
+ {
|
|
|
+ ErrorCodeEnum eErrOld = m_pEntity->GetFunction()->GetPath("DepBak", strOldPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[DepBak]%s,%s", SpStrError(eErrOld), strOldPath.GetData());
|
|
|
+ strOldPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", strOldPath.GetData(), fileName);
|
|
|
+
|
|
|
+ if (ExistsFileA(strOldPath.GetData())) //在旧Dep路径下找到文件时告警
|
|
|
+ {
|
|
|
+ strObjPath = strOldPath;
|
|
|
+ CSimpleStringA warnMsg = CSimpleStringA::Format("Find %s in OLD dep path!", strOldPath.GetData());
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, LOG_ERR_CUSTMNGRAUTH_FindFile_in_DepBak, warnMsg.GetData());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (ExistsFileA(strObjPath))
|
|
|
{
|
|
|
if (RemoveFileA(strObjPath))
|