|
@@ -413,7 +413,8 @@ void SPAServer::threadFromRedis(const CameraThreadInfo& info)
|
|
AlarmInfo alarmInfo;
|
|
AlarmInfo alarmInfo;
|
|
alarmInfo.ActionID = it.substr(it.find(":") + 1);
|
|
alarmInfo.ActionID = it.substr(it.find(":") + 1);
|
|
/* 解析数据 */
|
|
/* 解析数据 */
|
|
- parseRedisData(strRetValue, alarmInfo);
|
|
|
|
|
|
+ parseRedisBaseData(strRetValue, alarmInfo);
|
|
|
|
+ parseRedisBBoxesData(strRetValue, alarmInfo);
|
|
/* 信息时间有的效性判断,主要是记录Redis数据的有效性,是否长时间没有变化,排查错误时用的
|
|
/* 信息时间有的效性判断,主要是记录Redis数据的有效性,是否长时间没有变化,排查错误时用的
|
|
* 如果数据长时间数据不变,那么超脑那里就挂了,写入日志 */
|
|
* 如果数据长时间数据不变,那么超脑那里就挂了,写入日志 */
|
|
isEventTimeVaild(alarmInfo.EventTime);
|
|
isEventTimeVaild(alarmInfo.EventTime);
|
|
@@ -430,132 +431,132 @@ void SPAServer::threadFromRedis(const CameraThreadInfo& info)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-/* 解析Redis基础数据 */
|
|
|
|
-void SPAServer::parseRedisData(const std::string& strData, AlarmInfo& alarmInfo)
|
|
|
|
-{
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- nJson json0;
|
|
|
|
- json0 = nJson::parse(strData);
|
|
|
|
- alarmInfo.AlarmID = json0["alarmId"].get<int>();
|
|
|
|
- alarmInfo.ChannelID = json0["channel"].get<int>();
|
|
|
|
- alarmInfo.PicUrl = json0["picUrl"].get<std::string>();
|
|
|
|
- alarmInfo.ImageInfo = json0["imageInfo"].get<std::string>();
|
|
|
|
|
|
+// /* 解析Redis基础数据 */
|
|
|
|
+// void SPAServer::parseRedisData(const std::string& strData, AlarmInfo& alarmInfo)
|
|
|
|
+// {
|
|
|
|
+// try
|
|
|
|
+// {
|
|
|
|
+// nJson json0;
|
|
|
|
+// json0 = nJson::parse(strData);
|
|
|
|
+// alarmInfo.AlarmID = json0["alarmId"].get<int>();
|
|
|
|
+// alarmInfo.ChannelID = json0["channel"].get<int>();
|
|
|
|
+// alarmInfo.PicUrl = json0["picUrl"].get<std::string>();
|
|
|
|
+// alarmInfo.ImageInfo = json0["imageInfo"].get<std::string>();
|
|
|
|
|
|
- /* 解析时间,需要将时间中的“T”换成空格 */
|
|
|
|
- alarmInfo.StartTime = json0["beginTime"].get<std::string>();
|
|
|
|
- std::replace(alarmInfo.StartTime.begin(), alarmInfo.StartTime.end(), 'T', ' ');
|
|
|
|
- alarmInfo.EndTime = json0["endTime"].get<std::string>();
|
|
|
|
- std::replace(alarmInfo.EndTime.begin(), alarmInfo.EndTime.end(), 'T', ' ');
|
|
|
|
- alarmInfo.EventTime = json0["eventTime"].get<std::string>();
|
|
|
|
- std::replace(alarmInfo.EventTime.begin(), alarmInfo.EventTime.end(), 'T', ' ');
|
|
|
|
- /* 判断bBoxes有无数据,有数据就解析,没数据就直接返回了 */
|
|
|
|
- nJson json1 = json0["bBoxes"];
|
|
|
|
|
|
+// /* 解析时间,需要将时间中的“T”换成空格 */
|
|
|
|
+// alarmInfo.StartTime = json0["beginTime"].get<std::string>();
|
|
|
|
+// std::replace(alarmInfo.StartTime.begin(), alarmInfo.StartTime.end(), 'T', ' ');
|
|
|
|
+// alarmInfo.EndTime = json0["endTime"].get<std::string>();
|
|
|
|
+// std::replace(alarmInfo.EndTime.begin(), alarmInfo.EndTime.end(), 'T', ' ');
|
|
|
|
+// alarmInfo.EventTime = json0["eventTime"].get<std::string>();
|
|
|
|
+// std::replace(alarmInfo.EventTime.begin(), alarmInfo.EventTime.end(), 'T', ' ');
|
|
|
|
+// /* 判断bBoxes有无数据,有数据就解析,没数据就直接返回了 */
|
|
|
|
+// nJson json1 = json0["bBoxes"];
|
|
|
|
|
|
- std::string labelList; /* 记录违禁品 */
|
|
|
|
- std::string bboxList; /* 记录bbox */
|
|
|
|
- if(!json1.empty())
|
|
|
|
- {
|
|
|
|
- for(auto& it0 : json1)
|
|
|
|
- {
|
|
|
|
- /* 如果status是true,就不是报警,直接跳过 */
|
|
|
|
- bool status = it0["status"].get<bool>();
|
|
|
|
- if(status)
|
|
|
|
- {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- /* 这一条Box数据报警了将其内容存储起来 */
|
|
|
|
- alarmInfo.Is_Alarm = true;
|
|
|
|
- /* 解析label,违禁品关键字,先判断这个是不是违禁品检测的算法ID */
|
|
|
|
- if(alarmInfo.ActionID == g_actionList.ActContraband)
|
|
|
|
- {
|
|
|
|
- /* 解析报警,取出报警类型 */
|
|
|
|
- nJson label = it0["label"];
|
|
|
|
- for(auto& it1 : label)
|
|
|
|
- {
|
|
|
|
- std::string strLabel = it1.get<std::string>();
|
|
|
|
- /* 检测是否已经加入到字符串中了 */
|
|
|
|
- strLabel += "|";
|
|
|
|
- if(labelList.find(strLabel) != std::string::npos)
|
|
|
|
- {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- labelList += strLabel;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- /* 解析bbox,貌似是在图像中的位置 */
|
|
|
|
- nJson bbox = it0["bbox"];
|
|
|
|
- std::string strBbox;
|
|
|
|
- for(auto& it1 : bbox)
|
|
|
|
- {
|
|
|
|
- strBbox += std::to_string(it1.get<int>()) + ",";
|
|
|
|
- }
|
|
|
|
- /* 去掉最后一个“,” */
|
|
|
|
- if(!strBbox.empty())
|
|
|
|
- {
|
|
|
|
- strBbox.pop_back();
|
|
|
|
- }
|
|
|
|
- bboxList += strBbox + "|";
|
|
|
|
- }
|
|
|
|
- /* 去掉最后一个“|” */
|
|
|
|
- if(!labelList.empty())
|
|
|
|
- {
|
|
|
|
- labelList.pop_back();
|
|
|
|
- }
|
|
|
|
- if(!bboxList.empty())
|
|
|
|
- {
|
|
|
|
- bboxList.pop_back();
|
|
|
|
- }
|
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger, "违禁品列表:{}", labelList);
|
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger, "bbox列表:{}", bboxList);
|
|
|
|
- }
|
|
|
|
|
|
+// std::string labelList; /* 记录违禁品 */
|
|
|
|
+// std::string bboxList; /* 记录bbox */
|
|
|
|
+// if(!json1.empty())
|
|
|
|
+// {
|
|
|
|
+// for(auto& it0 : json1)
|
|
|
|
+// {
|
|
|
|
+// /* 如果status是true,就不是报警,直接跳过 */
|
|
|
|
+// bool status = it0["status"].get<bool>();
|
|
|
|
+// if(status)
|
|
|
|
+// {
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+// /* 这一条Box数据报警了将其内容存储起来 */
|
|
|
|
+// alarmInfo.Is_Alarm = true;
|
|
|
|
+// /* 解析label,违禁品关键字,先判断这个是不是违禁品检测的算法ID */
|
|
|
|
+// if(alarmInfo.ActionID == g_actionList.ActContraband)
|
|
|
|
+// {
|
|
|
|
+// /* 解析报警,取出报警类型 */
|
|
|
|
+// nJson label = it0["label"];
|
|
|
|
+// for(auto& it1 : label)
|
|
|
|
+// {
|
|
|
|
+// std::string strLabel = it1.get<std::string>();
|
|
|
|
+// /* 检测是否已经加入到字符串中了 */
|
|
|
|
+// strLabel += "|";
|
|
|
|
+// if(labelList.find(strLabel) != std::string::npos)
|
|
|
|
+// {
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+// labelList += strLabel;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// /* 解析bbox,貌似是在图像中的位置 */
|
|
|
|
+// nJson bbox = it0["bbox"];
|
|
|
|
+// std::string strBbox;
|
|
|
|
+// for(auto& it1 : bbox)
|
|
|
|
+// {
|
|
|
|
+// strBbox += std::to_string(it1.get<int>()) + ",";
|
|
|
|
+// }
|
|
|
|
+// /* 去掉最后一个“,” */
|
|
|
|
+// if(!strBbox.empty())
|
|
|
|
+// {
|
|
|
|
+// strBbox.pop_back();
|
|
|
|
+// }
|
|
|
|
+// bboxList += strBbox + "|";
|
|
|
|
+// }
|
|
|
|
+// /* 去掉最后一个“|” */
|
|
|
|
+// if(!labelList.empty())
|
|
|
|
+// {
|
|
|
|
+// labelList.pop_back();
|
|
|
|
+// }
|
|
|
|
+// if(!bboxList.empty())
|
|
|
|
+// {
|
|
|
|
+// bboxList.pop_back();
|
|
|
|
+// }
|
|
|
|
+// SPDLOG_LOGGER_DEBUG(m_logger, "违禁品列表:{}", labelList);
|
|
|
|
+// SPDLOG_LOGGER_DEBUG(m_logger, "bbox列表:{}", bboxList);
|
|
|
|
+// }
|
|
|
|
|
|
- /* 如果有报警的Box */
|
|
|
|
- if(alarmInfo.Is_Alarm)
|
|
|
|
- {
|
|
|
|
- /* 添加报警信息的提示信息 */
|
|
|
|
- alarmInfo.BboxList = bboxList;
|
|
|
|
- if( (alarmInfo.ActionID == g_actionList.ActContraband) && !labelList.empty() )
|
|
|
|
- {
|
|
|
|
- alarmInfo.ActionDes = fmt::format("出现违禁品[{}]告警", labelList);
|
|
|
|
- SPDLOG_LOGGER_INFO(m_logger, "{}", alarmInfo.ActionDes);
|
|
|
|
- }else {
|
|
|
|
- alarmInfo.ActionDes = json0["actionDes"].get<std::string>();
|
|
|
|
- }
|
|
|
|
- /* 判断有没有报警数据 */
|
|
|
|
- if(alarmInfo.ImageInfo.empty())
|
|
|
|
- {
|
|
|
|
- SPDLOG_LOGGER_ERROR(m_logger, "有报警区域,但是没有图片信息");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- /* 如果是人员报警,就存储人员报警信息 */
|
|
|
|
- if(alarmInfo.ActionID == g_actionList.ActFace)
|
|
|
|
- {
|
|
|
|
- nJson jsonArray = json0["personList"];
|
|
|
|
- for(auto& it : jsonArray)
|
|
|
|
- {
|
|
|
|
- PersonInfo personInfo;
|
|
|
|
- personInfo.PersonID = it["personId"].get<std::string>();
|
|
|
|
- personInfo.PersonName = it["personName"].get<std::string>();
|
|
|
|
- alarmInfo.vecPersonInfo.push_back(personInfo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// /* 如果有报警的Box */
|
|
|
|
+// if(alarmInfo.Is_Alarm)
|
|
|
|
+// {
|
|
|
|
+// /* 添加报警信息的提示信息 */
|
|
|
|
+// alarmInfo.BboxList = bboxList;
|
|
|
|
+// if( (alarmInfo.ActionID == g_actionList.ActContraband) && !labelList.empty() )
|
|
|
|
+// {
|
|
|
|
+// alarmInfo.ActionDes = fmt::format("出现违禁品[{}]告警", labelList);
|
|
|
|
+// SPDLOG_LOGGER_INFO(m_logger, "{}", alarmInfo.ActionDes);
|
|
|
|
+// }else {
|
|
|
|
+// alarmInfo.ActionDes = json0["actionDes"].get<std::string>();
|
|
|
|
+// }
|
|
|
|
+// /* 判断有没有报警数据 */
|
|
|
|
+// if(alarmInfo.ImageInfo.empty())
|
|
|
|
+// {
|
|
|
|
+// SPDLOG_LOGGER_ERROR(m_logger, "有报警区域,但是没有图片信息");
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+// /* 如果是人员报警,就存储人员报警信息 */
|
|
|
|
+// if(alarmInfo.ActionID == g_actionList.ActFace)
|
|
|
|
+// {
|
|
|
|
+// nJson jsonArray = json0["personList"];
|
|
|
|
+// for(auto& it : jsonArray)
|
|
|
|
+// {
|
|
|
|
+// PersonInfo personInfo;
|
|
|
|
+// personInfo.PersonID = it["personId"].get<std::string>();
|
|
|
|
+// personInfo.PersonName = it["personName"].get<std::string>();
|
|
|
|
+// alarmInfo.vecPersonInfo.push_back(personInfo);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
- catch (const nJson::parse_error& e)
|
|
|
|
- {
|
|
|
|
- SPDLOG_LOGGER_ERROR(m_logger, "解析Redis数据失败:{}, 错误ID:{}", e.what(), e.id);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- catch (const nJson::type_error& e)
|
|
|
|
- {
|
|
|
|
- SPDLOG_LOGGER_ERROR(m_logger, "解析Redis数据失败:{}, 错误ID:{}", e.what(), e.id);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
|
|
+// }
|
|
|
|
+// catch (const nJson::parse_error& e)
|
|
|
|
+// {
|
|
|
|
+// SPDLOG_LOGGER_ERROR(m_logger, "解析Redis数据失败:{}, 错误ID:{}", e.what(), e.id);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+// catch (const nJson::type_error& e)
|
|
|
|
+// {
|
|
|
|
+// SPDLOG_LOGGER_ERROR(m_logger, "解析Redis数据失败:{}, 错误ID:{}", e.what(), e.id);
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
/**
|
|
* @brief 解析Redis的基础通用数据,不包含bBoxes数组数据
|
|
* @brief 解析Redis的基础通用数据,不包含bBoxes数组数据
|
|
@@ -611,7 +612,7 @@ void SPAServer::parseRedisBBoxesData(const std::string& strData, AlarmInfo& alar
|
|
nJson json1 = json0["bBoxes"];
|
|
nJson json1 = json0["bBoxes"];
|
|
|
|
|
|
std::string labelList; /* 记录违禁品 */
|
|
std::string labelList; /* 记录违禁品 */
|
|
- std::string bboxList; /* 记录bbox */
|
|
|
|
|
|
+ std::list<std::string> listBbox; /* 记录bbox */
|
|
if(!json1.empty())
|
|
if(!json1.empty())
|
|
{
|
|
{
|
|
for(auto& it0 : json1)
|
|
for(auto& it0 : json1)
|
|
@@ -653,26 +654,21 @@ void SPAServer::parseRedisBBoxesData(const std::string& strData, AlarmInfo& alar
|
|
{
|
|
{
|
|
strBbox.pop_back();
|
|
strBbox.pop_back();
|
|
}
|
|
}
|
|
- bboxList += strBbox + "|";
|
|
|
|
|
|
+ listBbox.push_back(strBbox);
|
|
}
|
|
}
|
|
/* 去掉最后一个“|” */
|
|
/* 去掉最后一个“|” */
|
|
if(!labelList.empty())
|
|
if(!labelList.empty())
|
|
{
|
|
{
|
|
labelList.pop_back();
|
|
labelList.pop_back();
|
|
}
|
|
}
|
|
- if(!bboxList.empty())
|
|
|
|
- {
|
|
|
|
- bboxList.pop_back();
|
|
|
|
- }
|
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger, "违禁品列表:{}", labelList);
|
|
SPDLOG_LOGGER_DEBUG(m_logger, "违禁品列表:{}", labelList);
|
|
- SPDLOG_LOGGER_DEBUG(m_logger, "bbox列表:{}", bboxList);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
/* 如果有报警的Box,解析出报警的说明 */
|
|
/* 如果有报警的Box,解析出报警的说明 */
|
|
if(alarmInfo.Is_Alarm)
|
|
if(alarmInfo.Is_Alarm)
|
|
{
|
|
{
|
|
/* 添加报警信息的提示信息 */
|
|
/* 添加报警信息的提示信息 */
|
|
- alarmInfo.BboxList = bboxList;
|
|
|
|
|
|
+ alarmInfo.listBbox = listBbox;
|
|
/* 违禁品报警信息,违禁品列表不是空的,就添加补充的文字 */
|
|
/* 违禁品报警信息,违禁品列表不是空的,就添加补充的文字 */
|
|
if( (alarmInfo.ActionID == g_actionList.ActContraband) && !labelList.empty() )
|
|
if( (alarmInfo.ActionID == g_actionList.ActContraband) && !labelList.empty() )
|
|
{
|
|
{
|
|
@@ -836,6 +832,7 @@ void SPAServer::threadRoomCamera()
|
|
* @brief 人员在岗识别线程,这个功能主要是给客户端提供实时的人脸识别信息
|
|
* @brief 人员在岗识别线程,这个功能主要是给客户端提供实时的人脸识别信息
|
|
* 1、这个写入tWorkOnInfo表格,十分钟写一次
|
|
* 1、这个写入tWorkOnInfo表格,十分钟写一次
|
|
* 2、理论上这里需要实时更新数据库,但是实际上时每十分钟写入一次数据
|
|
* 2、理论上这里需要实时更新数据库,但是实际上时每十分钟写入一次数据
|
|
|
|
+ * 3、这个线程也会进行在岗离岗的识别报警
|
|
*
|
|
*
|
|
* @param RFAInfo 传入房间ID和算法ID
|
|
* @param RFAInfo 传入房间ID和算法ID
|
|
*/
|
|
*/
|
|
@@ -880,7 +877,8 @@ void SPAServer::threadActPersonWork(FuncActionInfo* RFAInfo)
|
|
}
|
|
}
|
|
/* 解析数据 */
|
|
/* 解析数据 */
|
|
AlarmInfo alarmInfo;
|
|
AlarmInfo alarmInfo;
|
|
- parseRedisData(strRetValue, alarmInfo);
|
|
|
|
|
|
+ parseRedisBaseData(strRetValue, alarmInfo);
|
|
|
|
+ parseRedisBBoxesData(strRetValue, alarmInfo);
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
{
|
|
{
|
|
@@ -924,7 +922,7 @@ void SPAServer::threadActPersonWork(FuncActionInfo* RFAInfo)
|
|
}
|
|
}
|
|
++it;
|
|
++it;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(g_config.ThreadSleepMS));
|
|
}
|
|
}
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
@@ -979,6 +977,13 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
{
|
|
{
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ /* 更新算法ActionID */
|
|
|
|
+ {
|
|
|
|
+ g_actionList.mutexRW.lockForRead();
|
|
|
|
+ strFaceActionID = g_actionList.ActFace;
|
|
|
|
+ strCountActionID = g_actionList.ActPersonNumber;
|
|
|
|
+ g_actionList.mutexRW.unlock();
|
|
|
|
+ }
|
|
|
|
|
|
/* 读取Redis数据 */
|
|
/* 读取Redis数据 */
|
|
pListAlarmInfo->clear();
|
|
pListAlarmInfo->clear();
|
|
@@ -996,7 +1001,9 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
}
|
|
}
|
|
/* 解析数据 */
|
|
/* 解析数据 */
|
|
AlarmInfo alarmInfo;
|
|
AlarmInfo alarmInfo;
|
|
- parseRedisData(strRetValue, alarmInfo);
|
|
|
|
|
|
+ // parseRedisData(strRetValue, alarmInfo);
|
|
|
|
+ parseRedisBaseData(strRetValue, alarmInfo);
|
|
|
|
+ parseRedisBBoxesData(strRetValue, alarmInfo);
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
{
|
|
{
|
|
@@ -1007,13 +1014,6 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
pListAlarmInfo->push_back(alarmInfo);
|
|
pListAlarmInfo->push_back(alarmInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- /* 更新算法ActionID */
|
|
|
|
- {
|
|
|
|
- g_actionList.mutexRW.lockForRead();
|
|
|
|
- strFaceActionID = g_actionList.ActFace;
|
|
|
|
- strCountActionID = g_actionList.ActPersonNumber;
|
|
|
|
- g_actionList.mutexRW.unlock();
|
|
|
|
- }
|
|
|
|
|
|
|
|
/* 找出房间的个数,按照房间进行判断 */
|
|
/* 找出房间的个数,按照房间进行判断 */
|
|
ListRoomIll listRoomIll;
|
|
ListRoomIll listRoomIll;
|
|
@@ -1033,7 +1033,7 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
if(it.vecPersonInfo.size() > room.numMaxFace)
|
|
if(it.vecPersonInfo.size() > room.numMaxFace)
|
|
{
|
|
{
|
|
room.numMaxFace = it.vecPersonInfo.size();
|
|
room.numMaxFace = it.vecPersonInfo.size();
|
|
- room.strBoxList = it.BboxList;
|
|
|
|
|
|
+ room.strBoxList = it.listBbox;
|
|
room.vecPersonInfo = it.vecPersonInfo;
|
|
room.vecPersonInfo = it.vecPersonInfo;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1067,7 +1067,7 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
if(it.vecPersonInfo.size() > room.numMaxPerson)
|
|
if(it.vecPersonInfo.size() > room.numMaxPerson)
|
|
{
|
|
{
|
|
room.numMaxPerson = it.vecPersonInfo.size();
|
|
room.numMaxPerson = it.vecPersonInfo.size();
|
|
- room.strBoxList = it.BboxList;
|
|
|
|
|
|
+ room.strBoxList = it.listBbox;
|
|
if(!it.ImageInfo.empty())
|
|
if(!it.ImageInfo.empty())
|
|
{
|
|
{
|
|
room.strImage = it.ImageInfo;
|
|
room.strImage = it.ImageInfo;
|
|
@@ -1087,10 +1087,11 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
/* 将非法入侵的信息存储到数组缓存中,等待报警结束后判断是否需要写入EQM数据库 */
|
|
/* 将非法入侵的信息存储到数组缓存中,等待报警结束后判断是否需要写入EQM数据库 */
|
|
for(auto& room : listRoomIll.getData())
|
|
for(auto& room : listRoomIll.getData())
|
|
{
|
|
{
|
|
|
|
+ auto pIll = pListIllInfo->findIllInfo(room.RoomID, room.RoomType);
|
|
if(room.isAlarm)
|
|
if(room.isAlarm)
|
|
{
|
|
{
|
|
/* 正在报警,检查是否有 */
|
|
/* 正在报警,检查是否有 */
|
|
- if(pListIllInfo->findIllInfo(room.RoomID, room.RoomType) == nullptr)
|
|
|
|
|
|
+ if(pIll == nullptr)
|
|
{
|
|
{
|
|
IllegalInvasionInfo info;
|
|
IllegalInvasionInfo info;
|
|
info.ChannelID = pRFAInfo->ChannelID;
|
|
info.ChannelID = pRFAInfo->ChannelID;
|
|
@@ -1103,12 +1104,41 @@ void SPAServer::threadActIllegalInvasion(FuncActionInfo* RFAInfo)
|
|
pListIllInfo->addIllInfo(info);
|
|
pListIllInfo->addIllInfo(info);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
/* 没有报警,检查是否是报警结束了,是否符合写入数据库的条件 */
|
|
/* 没有报警,检查是否是报警结束了,是否符合写入数据库的条件 */
|
|
QDateTime currTime = QDateTime::currentDateTime();
|
|
QDateTime currTime = QDateTime::currentDateTime();
|
|
|
|
+ int secs = currTime.toSecsSinceEpoch() - pIll->FirstTime.toSecsSinceEpoch();
|
|
|
|
+ if(secs >= g_config.AppBadMan)
|
|
|
|
+ {
|
|
|
|
+ if(!pIll->strImageInfo.empty())
|
|
|
|
+ {
|
|
|
|
+ /* 超过非法入侵的时间,写入数据库 */
|
|
|
|
+ AlarmInfo ai;
|
|
|
|
+ ai.ChannelID = pRFAInfo->ChannelID;
|
|
|
|
+ ai.RoomID = pIll->RoomID;
|
|
|
|
+ ai.ActionID = g_actionList.ActPersonNumber;
|
|
|
|
+ ai.ActionDes = pIll->strActionDec;
|
|
|
|
+ ai.ImageInfo = pIll->strImageInfo;
|
|
|
|
+ ai.StartTime = pIll->FirstTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
|
+ ai.EndTime = currTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
|
+ ai.EventTime = pIll->FirstTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
|
+ ai.vecPersonInfo = room.vecPersonInfo;
|
|
|
|
+ ai.listBbox = room.strBoxList;
|
|
|
|
+ bool insertRet = toEQMDataBase->insertAlarmInfo(ai);
|
|
|
|
+ if(insertRet)
|
|
|
|
+ {
|
|
|
|
+ std::string actionName = g_actionList.getActionName(ai.ActionID);
|
|
|
|
+ SPDLOG_LOGGER_INFO(m_logger, "☆ 新增报警信息,频道[{}],房间[{}],摄像头[{}],{},{},有{}个区域,有{}个人脸,{}",
|
|
|
|
+ pIll->ChannelID, pIll->RoomID, pIll->CameraID, actionName, ai.ActionDes, ai.listBbox, ai.FaceIDList.size(), ai.ImageInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /* 删除这个非法入侵信息 */
|
|
|
|
+ pListIllInfo->deleteIllInfo(*pIll);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(g_config.ThreadSleepMS));
|
|
}
|
|
}
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
@@ -1165,7 +1195,8 @@ void SPAServer::threadActRegionalPersonnelDetection(FuncActionInfo* RFAInfo)
|
|
}
|
|
}
|
|
/* 解析数据 */
|
|
/* 解析数据 */
|
|
AlarmInfo alarmInfo;
|
|
AlarmInfo alarmInfo;
|
|
- parseRedisData(strRetValue, alarmInfo);
|
|
|
|
|
|
+ parseRedisBaseData(strRetValue, alarmInfo);
|
|
|
|
+ parseRedisBBoxesData(strRetValue, alarmInfo);
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
/* 判断事件的时效性,超过多少秒不更新就可能是超脑挂了 */
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
if(isEventTimeVaild(alarmInfo.EventTime))
|
|
{
|
|
{
|
|
@@ -1179,7 +1210,7 @@ void SPAServer::threadActRegionalPersonnelDetection(FuncActionInfo* RFAInfo)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(g_config.ThreadSleepMS));
|
|
}
|
|
}
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
setThreadState(pRFAInfo, RunTimeState::RUN_STATE_STOP);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
SPDLOG_LOGGER_INFO(m_logger, "关闭 {} 线程,ChannelID:{}", pRFAInfo->strFunctionName, pRFAInfo->ChannelID);
|
|
@@ -1313,8 +1344,6 @@ void SPAServer::threadActNormal(FuncActionInfo* info)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/* 休眠设置的时间 */
|
|
/* 休眠设置的时间 */
|
|
std::this_thread::sleep_for(std::chrono::seconds(g_config.ThreadSleepMS));
|
|
std::this_thread::sleep_for(std::chrono::seconds(g_config.ThreadSleepMS));
|
|
}
|
|
}
|