|
@@ -1,9 +1,9 @@
|
|
|
#include "SPAServer.h"
|
|
|
|
|
|
#include "spdlog/spdlog.h"
|
|
|
-#include "CurlHttp.h"
|
|
|
+// #include "CurlHttp.h"
|
|
|
#include <filesystem>
|
|
|
-#include "CurlFtp.h"
|
|
|
+// #include "CurlFtp.h"
|
|
|
#include "ThreadPool/ThreadPool.h"
|
|
|
|
|
|
#include <QVector>
|
|
@@ -396,9 +396,13 @@ void SPAServer::threadFromRedis(const CameraThreadInfo& info)
|
|
|
alarmInfo.ActionID = it.substr(it.find(":") + 1);
|
|
|
/* 解析数据 */
|
|
|
parseRedisData(strRetValue, alarmInfo);
|
|
|
- /* 时间有效性判断 */
|
|
|
+ /* 信息时间有的效性判断,主要是记录Redis数据的有效性,是否长时间没有变化,排查错误时用的
|
|
|
+ * 如果数据长时间数据不变,那么超脑那里就挂了,写入日志 */
|
|
|
+ isEventTimeVaild(alarmInfo.EventTime);
|
|
|
+
|
|
|
+ /* 是否需要写入EQM数据库判断
|
|
|
+ * 人员计数和区域人员检测需要多次判断,其他的直接写入即可 */
|
|
|
|
|
|
- /* 是否需要写入EQM数据库判断 */
|
|
|
}
|
|
|
|
|
|
|
|
@@ -535,3 +539,20 @@ void SPAServer::parseRedisData(const std::string& strData, AlarmInfo& alarmInfo)
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/* 判断时间是否长时间没有更新 */
|
|
|
+bool SPAServer::isEventTimeVaild(const std::string& strTime)
|
|
|
+{
|
|
|
+ /* 获取当前时间 */
|
|
|
+ time_t now = time(0);
|
|
|
+ /* 字符串转成时间 */
|
|
|
+ tm tmTime;
|
|
|
+ strptime(strTime.c_str(), "%Y-%m-%d %H:%M:%S", &tmTime);
|
|
|
+ time_t eventTime = mktime(&tmTime);
|
|
|
+ /* 时间差 */
|
|
|
+ double diff = difftime(now, eventTime);
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger, "now:{} eventTime: {} 时间差:{}秒",now, eventTime, diff);
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|