|
@@ -1,9 +1,8 @@
|
|
|
#include "ToEQMDataBase.h"
|
|
|
|
|
|
#include <QJsonDocument>
|
|
|
-#include <QJsonObject>
|
|
|
-#include <QVector>
|
|
|
#include <QString>
|
|
|
+#include <QUuid>
|
|
|
|
|
|
ToEQMDataBase::ToEQMDataBase()
|
|
|
{
|
|
@@ -64,7 +63,7 @@ bool ToEQMDataBase::initWebApi(const QString& url, const QString& serverIP, cons
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"Login failed:{}, error info:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
|
}
|
|
|
- SPDLOG_LOGGER_TRACE(m_logger,"Login sucess!");
|
|
|
+ SPDLOG_LOGGER_INFO(m_logger,"Login WebAPI sucess!");
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -103,25 +102,29 @@ bool ToEQMDataBase::writeAlgorithmInfo(std::vector<AlgorithmInfo>& vecInfo)
|
|
|
/* 循环写入数据 */
|
|
|
try
|
|
|
{
|
|
|
+ nJson json0 = nJson::array();
|
|
|
for(const auto& it : vecInfo)
|
|
|
{
|
|
|
- QString retStr;
|
|
|
/* 操作名称,现在一次性将设备位置和线条信息都下载下来 */
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToAction";
|
|
|
nJson json1;
|
|
|
- json1["actionID"] = it.ActionID; /* 算法ID */
|
|
|
- json1["actionName"] = it.ActionName; /* 算法名称 */
|
|
|
- json1["actionTaskID"] = it.ActionTaskID; /* 算法类型 */
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, retStr);
|
|
|
- if(ret < 0)
|
|
|
- {
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"写入tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
- }
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"写入一条算法 {} 到 tAction成功!", it.ActionID);
|
|
|
+ json1["opName"] = "SPSS_InsertToAction";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ nJson json2;
|
|
|
+ json2["actionID"] = it.ActionID; /* 算法ID */
|
|
|
+ json2["actionName"] = it.ActionName; /* 算法名称 */
|
|
|
+ json2["actionTaskID"] = it.ActionTaskID; /* 算法类型 */
|
|
|
+ json1["paramList"] = json2;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
}
|
|
|
+ QString retStr;
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, retStr);
|
|
|
+ if(ret < 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"写入tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
catch (const nJson::parse_error& e) {
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"创建 算法JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
@@ -148,21 +151,41 @@ bool ToEQMDataBase::deleteAlgorithmInfo(std::vector<AlgorithmInfo>& vecDeleteInf
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- for(const auto& it : vecDeleteInfo)
|
|
|
+ try
|
|
|
{
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_DeleteFromAction";
|
|
|
- nJson json1;
|
|
|
- json1["actionID"] = it.ActionID;
|
|
|
- json0["paramList"] = json1;
|
|
|
+ nJson json0 = nJson::array();
|
|
|
+
|
|
|
+ for(const auto& it : vecDeleteInfo)
|
|
|
+ {
|
|
|
+ nJson json1;
|
|
|
+ json0["opName"] = "SPSS_DeleteFromAction";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ nJson json2;
|
|
|
+ json2["actionID"] = it.ActionID;
|
|
|
+ json0["paramList"] = json2;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
+ }
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
- int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
+ int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, strRet);
|
|
|
if(ret < 0)
|
|
|
{
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"删除tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"删除tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
}
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"从tAction 删除算法 {} 成功!", it.ActionID);
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除算法的JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除算法的JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除算法的JSON 数据失败");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -243,56 +266,66 @@ bool ToEQMDataBase::insertDeviceInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
bool isSuccess = true;
|
|
|
try
|
|
|
{
|
|
|
+ nJson json0 = nJson::array();
|
|
|
for(const auto& it : vecInfo)
|
|
|
{
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToCamerInfo";
|
|
|
nJson json1;
|
|
|
+ json1["opName"] = "SPSS_InsertToCamerInfo";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ nJson json2;
|
|
|
/* 这里不知道是不是“?”运算符的等级是不是不够,不加括号会报错 */
|
|
|
- json1["camerID"] = it.DeviceID;
|
|
|
- json1["camerName"] = it.DeviceName;
|
|
|
- json1["camerIP"] = it.DeviceIP;
|
|
|
- json1["camerPort"] = it.DevicePort;
|
|
|
- json1["camerUser"] = it.UserAccount;
|
|
|
- json1["camerPwd"] = it.UserPassword;
|
|
|
- json1["camerType"] = it.DeviceType;
|
|
|
- json1["camerSerial"] = it.DeviceSerial;
|
|
|
- json1["camerChannel"] = nullptr;
|
|
|
- json1["camerUrl"] = nullptr;
|
|
|
-
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
- {
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
- isSuccess = false;
|
|
|
- }
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入ID {} 信息到 CamerInfo 成功!", it.DeviceID);
|
|
|
+ json2["camerID"] = it.DeviceID;
|
|
|
+ json2["camerName"] = it.DeviceName;
|
|
|
+ json2["camerIP"] = it.DeviceIP;
|
|
|
+ json2["camerPort"] = it.DevicePort;
|
|
|
+ json2["camerUser"] = it.UserAccount;
|
|
|
+ json2["camerPwd"] = it.UserPassword;
|
|
|
+ json2["camerType"] = it.DeviceType;
|
|
|
+ json2["camerSerial"] = it.DeviceSerial;
|
|
|
+ json2["camerChannel"] = nullptr;
|
|
|
+ json2["camerUrl"] = nullptr;
|
|
|
+
|
|
|
+ json1["paramList"] = json2;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
}
|
|
|
- /* 插入信息到tActionCamer表 */
|
|
|
- for(const auto& it0 : vecInfo)
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, strRet);
|
|
|
+ if(ret < 0)
|
|
|
{
|
|
|
- for(const auto& it1 : it0.vecAlgorithmInfo)
|
|
|
- {
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToActionCamer";
|
|
|
- nJson json1;
|
|
|
- json1["actionID"] = it1.ActionID;
|
|
|
- json1["camerID"] = it0.DeviceID;
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
- {
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
- isSuccess = false;
|
|
|
- }
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入DeviceID {} 和 ActionID {} 到 ActionCamer 成功!", it0.DeviceID, it1.ActionID);
|
|
|
- }
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ isSuccess = false;
|
|
|
}
|
|
|
+
|
|
|
+ // /* 插入信息到tActionCamer表 */
|
|
|
+ // json0.clear();
|
|
|
+ // for(const auto& it0 : vecInfo)
|
|
|
+ // {
|
|
|
+ // for(const auto& it1 : it0.vecAlgorithmInfo)
|
|
|
+ // {
|
|
|
+ // nJson json1;
|
|
|
+ // json1["opName"] = "SPSS_InsertToActionCamer";
|
|
|
+ // json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ // nJson json2;
|
|
|
+ // json2["actionID"] = it1.ActionID;
|
|
|
+ // json2["camerID"] = it0.DeviceID;
|
|
|
+ // json1["paramList"] = json1;
|
|
|
+
|
|
|
+ // json0.push_back(json1);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // strCmd.clear();
|
|
|
+ // strRet.clear();
|
|
|
+ // ret = 0;
|
|
|
+ // strCmd = QString::fromStdString(json0.dump());
|
|
|
+ // ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
+ // if(ret < 0)
|
|
|
+ // {
|
|
|
+ // SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ // isSuccess = false;
|
|
|
+ // }
|
|
|
+
|
|
|
}
|
|
|
catch (const nJson::parse_error& e) {
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"创建 设备信息JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
@@ -324,34 +357,40 @@ bool ToEQMDataBase::updateDeviceInfo(std::vector<DeviceInfo>& vecUpdateInfo)
|
|
|
return false;
|
|
|
}
|
|
|
bool isSuccess = true;
|
|
|
- try{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nJson json0 = nJson::array();
|
|
|
for(const auto& it : vecUpdateInfo)
|
|
|
{
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_UpdateToCamerInfo";
|
|
|
nJson json1;
|
|
|
- json1["camerID"] = it.DeviceID;
|
|
|
- json1["camerName"] = it.DeviceName;
|
|
|
- json1["camerIP"] = it.DeviceIP;
|
|
|
- json1["camerPort"] = it.DevicePort;
|
|
|
- json1["camerUser"] = it.UserAccount;
|
|
|
- json1["camerPwd"] = it.UserPassword;
|
|
|
- json1["camerType"] = it.DeviceType;
|
|
|
- json1["camerSerial"] = it.DeviceSerial;
|
|
|
- json1["camerChannel"] = nullptr;
|
|
|
- json1["camerUrl"] = nullptr;
|
|
|
+ json1["opName"] = "SPSS_UpdateToCamerInfo";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ nJson json2;
|
|
|
+ json2["camerID"] = it.DeviceID;
|
|
|
+ json2["camerName"] = it.DeviceName;
|
|
|
+ json2["camerIP"] = it.DeviceIP;
|
|
|
+ json2["camerPort"] = it.DevicePort;
|
|
|
+ json2["camerUser"] = it.UserAccount;
|
|
|
+ json2["camerPwd"] = it.UserPassword;
|
|
|
+ json2["camerType"] = it.DeviceType;
|
|
|
+ json2["camerSerial"] = it.DeviceSerial;
|
|
|
+ json2["camerChannel"] = nullptr;
|
|
|
+ json2["camerUrl"] = nullptr;
|
|
|
+
|
|
|
+ json1["paramList"] = json2;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
+ }
|
|
|
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
- {
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"更新设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
- isSuccess = false;
|
|
|
- }
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"更新ID {} 信息到 CamerInfo 成功!", it.DeviceID);
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strCmd, strRet);
|
|
|
+ if(ret < 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"更新设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ isSuccess = false;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
catch (const nJson::parse_error& e) {
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"创建 更新设备信息JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
@@ -381,26 +420,46 @@ bool ToEQMDataBase::deleteDeviceInfo(std::vector<DeviceInfo>& vecDeleteInfo)
|
|
|
}
|
|
|
if(vecDeleteInfo.empty())
|
|
|
{
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
bool isSuccess = true;
|
|
|
|
|
|
- for(const auto& it : vecDeleteInfo)
|
|
|
+ try
|
|
|
{
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_DeleteFromCamerInfo";
|
|
|
- nJson json1;
|
|
|
- json1["camerID"] = it.DeviceID;
|
|
|
- json0["paramList"] = json1;
|
|
|
+ nJson json0 = nJson::array();
|
|
|
+ for(const auto& it : vecDeleteInfo)
|
|
|
+ {
|
|
|
+ nJson json1;
|
|
|
+ json1["opName"] = "SPSS_DeleteFromCamerInfo";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+
|
|
|
+ nJson json2;
|
|
|
+ json2["camerID"] = it.DeviceID;
|
|
|
+ json1["paramList"] = json1;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
+ }
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
if(ret < 0)
|
|
|
{
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"删除设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"删除tCamerinfo设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
isSuccess = false;
|
|
|
}
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"删除数据 {} 到 CamerInfo 成功!", it.DeviceID);
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除设备信息JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除设备信息JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 删除设备信息JSON 数据失败");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
return isSuccess;
|
|
@@ -474,6 +533,23 @@ bool ToEQMDataBase::getDeviceInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+/* 获取通道信息 */
|
|
|
+bool ToEQMDataBase::getChannelInfo(std::map<int, std::string>& mapChannelName)
|
|
|
+{
|
|
|
+ if(m_httpApi == nullptr)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"WebApi is nullptr");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/* 获取摄像机信息 */
|
|
|
+bool ToEQMDataBase::getCameraInfo(std::map<int, std::string>& mapCameraName)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
/* 插入设备和算法关联信息 */
|
|
|
bool ToEQMDataBase::insertDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
{
|
|
@@ -483,27 +559,44 @@ bool ToEQMDataBase::insertDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
return false;
|
|
|
}
|
|
|
/* 插入信息到tActionCamer表 */
|
|
|
- bool isSuccess = true;
|
|
|
- for(const auto& it0 : vecInfo)
|
|
|
+ try
|
|
|
{
|
|
|
- for(const auto& it1 : it0.vecAlgorithmInfo)
|
|
|
+ nJson json0 = nJson::array();
|
|
|
+ for(const auto& it0 : vecInfo)
|
|
|
{
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToActionCamer";
|
|
|
- nJson json1;
|
|
|
- json1["actionID"] = it1.ActionID;
|
|
|
- json1["camerID"] = it0.DeviceID;
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ for(const auto& it1 : it0.vecAlgorithmInfo)
|
|
|
{
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
- isSuccess = false;
|
|
|
+ nJson json1;
|
|
|
+ json1["opName"] = "SPSS_InsertToActionCamer";
|
|
|
+ json1["Key"] = QUuid::createUuid().toString().toStdString();
|
|
|
+ nJson json2;
|
|
|
+ json2["actionID"] = it1.ActionID;
|
|
|
+ json2["camerID"] = it0.DeviceID;
|
|
|
+ json1["paramList"] = json1;
|
|
|
+
|
|
|
+ json0.push_back(json1);
|
|
|
}
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入DeviceID {} 和 ActionID {} 到 ActionCamer 成功!", it0.DeviceID, it1.ActionID);
|
|
|
}
|
|
|
+ QString strRet;
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
+ if(ret < 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 写入tActionCamer JSON失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 写入tActionCamer JSON失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"创建 写入tActionCamer JSON失败 数据失败");
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -773,7 +866,7 @@ bool ToEQMDataBase::getActionInfo(ListActionInfo& listInfo)
|
|
|
info.CameraID = it["camerId"].is_null() ? -1 : it["camerId"].get<int>();
|
|
|
info.ActionID = it["actionId"].is_null() ? "" : it["actionId"].get<std::string>();
|
|
|
info.RoomID = it["roomId"].is_null() ? -1 : it["roomId"].get<int>();
|
|
|
- info.ChannelID = it["chnid"].is_null() ? -1 : it["chnid"].get<int>();
|
|
|
+ info.ChannelID = it["chnId"].is_null() ? -1 : it["chnId"].get<int>();
|
|
|
info.RoomType = it["rtype"].is_null() ? -1 : it["rtype"].get<int>();
|
|
|
info.strRoomName = it["rname"].is_null() ? "" : it["rname"].get<std::string>();
|
|
|
listInfo.insertActionInfo(&info);
|
|
@@ -1031,11 +1124,16 @@ bool ToEQMDataBase::getPersonCountRuleInfo(std::vector<PersonCountRuleInfo>& vec
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"解析AlarmRule数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
return false;
|
|
|
}
|
|
|
+ catch(...)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析AlarmRule数据失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-/* 获取报警时段,也同时获取报警的应用信息 */
|
|
|
+/* 获取报警时段,也同时获取报警的应用信息,tPeriod表 */
|
|
|
bool ToEQMDataBase::getAlarmAppInfo(std::list<AppAndTimeInfo>& listInfo)
|
|
|
{
|
|
|
nJson json0;
|
|
@@ -1076,12 +1174,17 @@ bool ToEQMDataBase::getAlarmAppInfo(std::list<AppAndTimeInfo>& listInfo)
|
|
|
}
|
|
|
}
|
|
|
catch (const nJson::parse_error& e) {
|
|
|
- SPDLOG_LOGGER_ERROR(m_logger,"解析AlarmApp数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析tPeriod数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
return false;
|
|
|
}
|
|
|
catch(const nJson::type_error& e)
|
|
|
{
|
|
|
- SPDLOG_LOGGER_ERROR(m_logger,"解析AlarmApp数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析tPeriod数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析tPeriod数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -1089,7 +1192,7 @@ bool ToEQMDataBase::getAlarmAppInfo(std::list<AppAndTimeInfo>& listInfo)
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* 写入在岗信息 */
|
|
|
+/* 写入在岗信息 tWorkOnInfo */
|
|
|
bool ToEQMDataBase::insertOnWorkInfo(const RoomFaceInfo& onWorkInfo)
|
|
|
{
|
|
|
if(m_httpApi == nullptr)
|
|
@@ -1113,31 +1216,46 @@ bool ToEQMDataBase::insertOnWorkInfo(const RoomFaceInfo& onWorkInfo)
|
|
|
strFaceID = strFaceID.substr(0, strFaceID.size() - 1);
|
|
|
strFaceName = strFaceName.substr(0, strFaceName.size() - 1);
|
|
|
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_InsertToOnWork";
|
|
|
+ nJson json1;
|
|
|
+ json1["nChID"] = onWorkInfo.ChannelID;
|
|
|
+ json1["CamerId"] = onWorkInfo.CameraID;
|
|
|
+ json1["FaceIdList"] = strFaceID;
|
|
|
+ json1["FaceNameList"] = strFaceName;
|
|
|
+ json1["StartTime"] = onWorkInfo.StartTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
+ json1["EndTime"] = onWorkInfo.EndTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
+ json1["MaxNumber"] = onWorkInfo.MaxNum;
|
|
|
+ json1["MinNumber"] = onWorkInfo.MinNum;
|
|
|
|
|
|
+ json0["paramList"] = json1;
|
|
|
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToOnWork";
|
|
|
- nJson json1;
|
|
|
- json1["nChID"] = onWorkInfo.ChannelID;
|
|
|
- json1["CamerId"] = onWorkInfo.CameraID;
|
|
|
- json1["FaceIdList"] = strFaceID;
|
|
|
- json1["FaceNameList"] = strFaceName;
|
|
|
- json1["StartTime"] = onWorkInfo.StartTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
- json1["EndTime"] = onWorkInfo.EndTime.toString("yyyy-MM-dd hh:mm:ss").toStdString();
|
|
|
- json1["MaxNumber"] = onWorkInfo.MaxNum;
|
|
|
- json1["MinNumber"] = onWorkInfo.MinNum;
|
|
|
-
|
|
|
- json0["paramList"] = json1;
|
|
|
-
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
+ if(ret < 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_WARN(m_logger,"插入 tWorkOnInfo 失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // SPDLOG_LOGGER_DEBUG(m_logger,"插入在岗信息成功!");
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"生成 tWorkOnInfo JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(const nJson::type_error& e)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"生成 tWorkOnInfo JSON 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...)
|
|
|
{
|
|
|
- SPDLOG_LOGGER_WARN(m_logger,"插入在岗信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"生成 tWorkOnInfo JSON 数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入在岗信息成功!");
|
|
|
|
|
|
return true;
|
|
|
}
|