ソースを参照

Z991239-6438 #comment feat: 1.头像图片缺失跳出读证循环报错 2.图片时间异常判断报错

陈纪林80310970 1 ヶ月 前
コミット
95a6fbd0ca

+ 70 - 5
Module/mod_IDCertificate/IDCertFSM.cpp

@@ -517,6 +517,10 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
 	m_bCancelRead = false;
 	m_bReading = true;
 	m_bExit = false;
+	m_bGetHeadPhotoFailed = false;
+	m_bHeadPhotoTimeError = false;
+	m_bFrontPhotoTimeError = false;
+	m_bBackPhotoTimeError = false;
 
 	LogEvent(Severity_Middle, LOG_EVT_IDCERTIFICATE_GREEN_ON, "IDCer warning on");
 	while (elapsed < IDCER_READ_TIMEOUT && (errReadEx2 != Error_Succeed) && !m_bCancelRead)
@@ -587,6 +591,10 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
 
 					//转换数据并赋值至传出字段
 					CopyIDCerDataToCtx(idInfoEx2, ctx);
+					if (m_bGetHeadPhotoFailed)
+					{
+						break;
+					}
 					ctx->Ans.photodata = ctx->Ans.headphoto; //现接口继续保持复制图片,JS接口下掉photodata字段 - 2025.6.17
 
 					ctx->Ans.hasscan = 0;
@@ -637,7 +645,30 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
 
 	if (errReadEx2 == Error_Succeed)
 	{
-		ctx->Answer(Error_Succeed);
+		if (m_bGetHeadPhotoFailed) //头像图片获取失败
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Get Headphoto failed!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_GetHeadPhotoFailed);
+		}
+		else if (m_bHeadPhotoTimeError) //头像图片修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Headphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_HeadPhotoTimeError);
+		}
+		else if (m_bFrontPhotoTimeError) //正面扫描件修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Frontphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_FrontPhotoTimeError);
+		}
+		else if (m_bBackPhotoTimeError) //背面扫描件修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Backphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_BackPhotoTimeError);
+		}
+		else
+		{
+			ctx->Answer(Error_Succeed);
+		}
 	}
 	else if (m_bCancelRead)
 	{
@@ -729,6 +760,10 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
 	m_bCancelRead = false;
 	m_bReading = true;
 	m_bExit = false;
+	m_bGetHeadPhotoFailed = false;
+	m_bHeadPhotoTimeError = false;
+	m_bFrontPhotoTimeError = false;
+	m_bBackPhotoTimeError = false;
 
 	LogEvent(Severity_Middle, LOG_EVT_IDCERTIFICATE_GREEN_ON, "IDCer warning on");
 	while (elapsed < IDCER_READ_TIMEOUT && (errReadEx2 != Error_Succeed) && !m_bCancelRead)
@@ -792,6 +827,10 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
 
 				//转换数据并赋值至传出字段
 				CopyIDCerDataToCtx(idInfoEx2, ctx);
+				if (m_bGetHeadPhotoFailed)
+				{
+					break;
+				}
 
 				ctx->Ans.hasscan = 0;
 				if (igestionVer == TRUE) //吸入式设备才调用正反扫描功能
@@ -840,7 +879,30 @@ int CIDCertFSM::ReadAndScanUTF8JS(SpReqAnsContext<IDCert_ReadAndScanUTF8JS_Req,
 
 	if (errReadEx2 == Error_Succeed)
 	{
-		ctx->Answer(Error_Succeed);
+		if (m_bGetHeadPhotoFailed) //头像图片获取失败
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Get Headphoto failed!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_GetHeadPhotoFailed);
+		}
+		else if (m_bHeadPhotoTimeError) //头像图片修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Headphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_HeadPhotoTimeError);
+		}
+		else if (m_bFrontPhotoTimeError) //正面扫描件修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Frontphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_FrontPhotoTimeError);
+		}
+		else if (m_bBackPhotoTimeError) //背面扫描件修改时间异常
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setResultCode("RTAXXXX")("Backphoto time error!");
+			ctx->Answer(Error_Unexpect, IDCertificate_UserErrorCode_ReadAndScan_BackPhotoTimeError);
+		}
+		else
+		{
+			ctx->Answer(Error_Succeed);
+		}
 	}
 	else if (m_bCancelRead)
 	{
@@ -974,6 +1036,7 @@ ErrorCodeEnum CIDCertFSM::GetPngBlobEx(CBlob &data, CSimpleStringA fileNamePrefi
 			errInfo["description"] = disecription.GetData();
 			tErrStr = generateJsonStr(errInfo).second.c_str();
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode(imgRTACode).setAPI("DeleteFileIfExisted")(tErrStr.GetData());
+			m_bGetHeadPhotoFailed = true;
 		}
 
 		errMsg = CSimpleStringA::Format("read file %s.bmp failed.err:%d", (const char*)strPath, GetLastError());
@@ -1777,9 +1840,11 @@ void CIDCertFSM::WarnImgCreateTime()
 	CSimpleStringA fileTimeWarn = CSimpleStringA::Format("头像图片时间:[%s], 正面图片时间:[%s],背面图片时间:[%s]",
 		headPhotoTimeStr.GetData(), frontPhotoTimeStr.GetData(), backPhotoTimeStr.GetData());
 	SeverityLevelEnum ImgTimeWarnLevel = Severity_Low;
-	if ((headPhotoTime > 0 && headPhotoTime < currentSysTime) ||
-		(frontPhotoTime > 0 && frontPhotoTime < currentSysTime) ||
-		(backPhotoTime > 0 && backPhotoTime < currentSysTime))
+	m_bHeadPhotoTimeError = headPhotoTime > 0 && headPhotoTime < currentSysTime;
+	m_bFrontPhotoTimeError = frontPhotoTime > 0 && frontPhotoTime < currentSysTime;
+	m_bBackPhotoTimeError = backPhotoTime > 0 && backPhotoTime < currentSysTime;
+
+	if (m_bHeadPhotoTimeError || m_bFrontPhotoTimeError || m_bBackPhotoTimeError)
 	{
 		ImgTimeWarnLevel = Severity_Middle;			//若生成图片的时间早于本次交易时间,则告LEVEL2
 	}

+ 3 - 2
Module/mod_IDCertificate/IDCertFSM.h

@@ -229,7 +229,8 @@ public:
 	END_FSM_RULE()
 
 		CIDCertFSM() :m_bCancelRead(false), m_bReading(false),
-		m_bExit(false), m_testResult(Error_Succeed), m_getDevCategory(Error_Unexpect), m_csMachineType(""), m_terminalNo(""), transImgMsg("")
+		m_bExit(false), m_bGetHeadPhotoFailed(false), m_bHeadPhotoTimeError(false), m_bFrontPhotoTimeError(false), m_bBackPhotoTimeError(false),
+		m_testResult(Error_Succeed), m_getDevCategory(Error_Unexpect), m_csMachineType(""), m_terminalNo(""), transImgMsg("")
 	{
 		ZeroMemory(&m_adapterInfo, sizeof(m_adapterInfo));
 		HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x201);
@@ -305,7 +306,7 @@ private:
 public:
 		std::string checkImgURL;
 private:
-	bool m_bCancelRead, m_bReading, m_bExit;
+	bool m_bCancelRead, m_bReading, m_bExit, m_bGetHeadPhotoFailed, m_bHeadPhotoTimeError, m_bFrontPhotoTimeError, m_bBackPhotoTimeError;
 	ErrorCodeEnum m_testResult;
 	ErrorCodeEnum m_getDevCategory;
 	DevCategoryInfo m_devCatInfo;

+ 4 - 0
Module/mod_IDCertificate/IDCertificate_UserErrorCode.h

@@ -27,6 +27,10 @@
 #define IDCertificate_UserErrorCode_FindFile_in_DepBak			0x20100220 //旧dep目录下获取到厂商文件
 #define IDCertificate_UserErrorCode_Timeout_NoCard			0x20100221 //超时未插卡
 #define IDCertificate_UserErrorCode_Timeout_OtherCard		0x20100222 //插入其他卡片(非身份证)
+#define IDCertificate_UserErrorCode_ReadAndScan_GetHeadPhotoFailed	0x20100223 //获取芯片头像图片失败
+#define IDCertificate_UserErrorCode_ReadAndScan_HeadPhotoTimeError	0x20100224 //头像图片时间异常
+#define IDCertificate_UserErrorCode_ReadAndScan_FrontPhotoTimeError	0x20100225 //正面扫描件时间异常
+#define IDCertificate_UserErrorCode_ReadAndScan_BackPhotoTimeError	0x20100226 //背面扫描件时间异常
 
 #define IDCertificate_UserErrorCode_GetImgFileTime			0x20100230 //图片文件的最近修改时间