|
@@ -40,7 +40,7 @@ bool ToEQMDataBase::initWebApi(const QString& url, const QString& serverIP, cons
|
|
|
}
|
|
|
|
|
|
m_httpApi->DBInit(url.toStdString().c_str());
|
|
|
- // if(ret < 0)
|
|
|
+ // if(ret != 0)
|
|
|
// {
|
|
|
// SPDLOG_LOGGER_ERROR(m_logger,"Init WebApi failed:{}, error Info:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
// return false;
|
|
@@ -49,7 +49,7 @@ bool ToEQMDataBase::initWebApi(const QString& url, const QString& serverIP, cons
|
|
|
/* 获取服务器列表 */
|
|
|
char serverList[8192];
|
|
|
ret = m_httpApi->DBGetServerList(serverList, 8192);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"Get server list failed:{}, error info:{}",ret, m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -58,7 +58,7 @@ bool ToEQMDataBase::initWebApi(const QString& url, const QString& serverIP, cons
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"WebAPI Sucess!");
|
|
|
/* 登录,第二个参数是限制的服务 */
|
|
|
ret = m_httpApi->DBLogin(serverIP, serID, "SPSS", m_userToken);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"Login failed:{}, error info:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -120,7 +120,7 @@ bool ToEQMDataBase::writeAlgorithmInfo(std::vector<AlgorithmInfo>& vecInfo)
|
|
|
QString retStr;
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, retStr);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"写入tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
}
|
|
@@ -169,7 +169,7 @@ bool ToEQMDataBase::deleteAlgorithmInfo(std::vector<AlgorithmInfo>& vecDeleteInf
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"删除tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -208,7 +208,7 @@ bool ToEQMDataBase::getAlgorithmInfo(std::vector<AlgorithmInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取tAction失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -292,7 +292,7 @@ bool ToEQMDataBase::insertDeviceInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
isSuccess = false;
|
|
@@ -320,7 +320,7 @@ bool ToEQMDataBase::insertDeviceInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
// ret = 0;
|
|
|
// strCmd = QString::fromStdString(json0.dump());
|
|
|
// ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- // if(ret < 0)
|
|
|
+ // if(ret != 0)
|
|
|
// {
|
|
|
// SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
// isSuccess = false;
|
|
@@ -385,7 +385,7 @@ bool ToEQMDataBase::updateDeviceInfo(std::vector<DeviceInfo>& vecUpdateInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"更新设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
isSuccess = false;
|
|
@@ -442,7 +442,7 @@ bool ToEQMDataBase::deleteDeviceInfo(std::vector<DeviceInfo>& vecDeleteInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"删除tCamerinfo设备信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
isSuccess = false;
|
|
@@ -480,7 +480,7 @@ bool ToEQMDataBase::getDeviceInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取CamerInfo失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -541,13 +541,166 @@ bool ToEQMDataBase::getChannelInfo(std::map<int, std::string>& mapChannelName)
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"WebApi is nullptr");
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_SelectChannelInfo";
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"获取通道信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /* 解析信息 */
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
+ int retCode = json1["code"].get<int>();
|
|
|
+ if(retCode != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"获取通道信息失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ nJson result = json1["result"];
|
|
|
+ if(result.empty())
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(const auto& it : result)
|
|
|
+ {
|
|
|
+ int id = it["chnID"].get<int>();
|
|
|
+ std::string chnName = it["chnName"].is_null() ? "" : it["chnName"].get<std::string>();
|
|
|
+ mapChannelName.insert(std::make_pair(id, chnName));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
+std::string ToEQMDataBase::getChannelName(int chnID)
|
|
|
+{
|
|
|
+ if(m_httpApi == nullptr)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"WebApi is nullptr");
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_SelectChannelInfo";
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"获取通道信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return "false;";
|
|
|
+ }
|
|
|
+ /* 解析信息 */
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
+ int retCode = json1["code"].get<int>();
|
|
|
+ if(retCode != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"获取通道信息失败");
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ nJson result = json1["result"];
|
|
|
+ if(result.empty())
|
|
|
+ {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ for(const auto& it : result)
|
|
|
+ {
|
|
|
+ int id = it["chnID"].get<int>();
|
|
|
+ if(id == chnID)
|
|
|
+ {
|
|
|
+ return it.dump();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败");
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
/* 获取摄像机信息 */
|
|
|
bool ToEQMDataBase::getCameraInfo(std::map<int, std::string>& mapCameraName)
|
|
|
{
|
|
|
+ if(m_httpApi == nullptr)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"WebApi is nullptr");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_SelectCameraInfo";
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_DEBUG(m_logger,"获取通道信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /* 解析信息 */
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
+ int retCode = json1["code"].get<int>();
|
|
|
+ if(retCode != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"获取通道信息失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ nJson result = json1["result"];
|
|
|
+ if(result.empty())
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(const auto& it : result)
|
|
|
+ {
|
|
|
+ int id = it["camerId"].get<int>();
|
|
|
+ std::string camerName = it["camerName"].is_null() ? "" : it["camerName"].get<std::string>();
|
|
|
+ mapCameraName.insert(std::make_pair(id, camerName));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const nJson::parse_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (const nJson::type_error& e) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败:{}, 错误ID:{}",e.what(), e.id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch(...) {
|
|
|
+ SPDLOG_LOGGER_ERROR(m_logger,"解析 tChannel数据失败 数据失败");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/* 插入设备和算法关联信息 */
|
|
@@ -580,7 +733,7 @@ bool ToEQMDataBase::insertDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strRet;
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -621,7 +774,7 @@ bool ToEQMDataBase::updateDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"删除设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
// return false;
|
|
@@ -643,7 +796,7 @@ bool ToEQMDataBase::updateDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"插入设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
isSuccess = false;
|
|
@@ -676,7 +829,7 @@ bool ToEQMDataBase::deleteDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"删除设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
// return false;
|
|
@@ -709,7 +862,7 @@ bool ToEQMDataBase::deleteDeviceAlgorithmInfo(std::list<int>& vecID)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"删除设备信息到tActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
// return false;
|
|
@@ -741,7 +894,7 @@ bool ToEQMDataBase::getDeviceAlgorithmInfo(std::vector<DeviceInfo>& vecInfo, std
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取ActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -839,7 +992,7 @@ bool ToEQMDataBase::getActionInfo(ListActionInfo& listInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取ActionCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -904,7 +1057,7 @@ bool ToEQMDataBase::getRoomCameraInfo(std::list<RoomCameraInfo>& vecInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取RoomCamer失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -995,36 +1148,51 @@ bool ToEQMDataBase::insertAlarmInfo(const AlarmInfo& alarmInfo)
|
|
|
/* 去掉最后一个“|” */
|
|
|
strBbox.pop_back();
|
|
|
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_InsertToAlarmInfo";
|
|
|
- nJson json1;
|
|
|
- json1["AlarmID"] = alarmInfo.AlarmID;
|
|
|
- json1["StartTime"] = alarmInfo.StartTime;
|
|
|
- json1["CreateTime"] = alarmInfo.EventTime;
|
|
|
- json1["EndTime"] = alarmInfo.EndTime;
|
|
|
- json1["bBox"] = strBbox;
|
|
|
- json1["PicUrl"] = alarmInfo.PicUrl;
|
|
|
- json1["AppID"] = alarmInfo.AppID;
|
|
|
- json1["ActionID"] = alarmInfo.ActionID;
|
|
|
- json1["ActionDes"] = alarmInfo.ActionDes;
|
|
|
- json1["CamerID"] = alarmInfo.DeviceID;
|
|
|
- json1["RoomID"] = alarmInfo.RoomID;
|
|
|
- json1["chnID"] = alarmInfo.ChannelID;
|
|
|
- json1["Stat"] = alarmInfo.State;
|
|
|
- json0["FaceIDList"] = alarmInfo.FaceIDList;
|
|
|
- json0["FaceNameList"] = alarmInfo.FaceNameList;
|
|
|
- json0["OnWork"] = alarmInfo.OnWork;
|
|
|
-
|
|
|
- json0["paramList"] = json1;
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ try
|
|
|
{
|
|
|
- SPDLOG_LOGGER_WARN(m_logger,"插入报警信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_InsertToAlarmInfo";
|
|
|
+ nJson json1;
|
|
|
+ json1["AlarmID"] = alarmInfo.AlarmID;
|
|
|
+ json1["StartTime"] = alarmInfo.StartTime;
|
|
|
+ json1["CreateTime"] = alarmInfo.EventTime;
|
|
|
+ json1["EndTime"] = alarmInfo.EndTime;
|
|
|
+ json1["bBox"] = strBbox;
|
|
|
+ json1["PicUrl"] = alarmInfo.PicUrl;
|
|
|
+ json1["AppID"] = alarmInfo.AppID;
|
|
|
+ json1["ActionID"] = alarmInfo.ActionID;
|
|
|
+ json1["ActionDes"] = alarmInfo.ActionDes;
|
|
|
+ json1["CamerID"] = alarmInfo.DeviceID;
|
|
|
+ json1["RoomID"] = alarmInfo.RoomID;
|
|
|
+ json1["chnID"] = alarmInfo.ChannelID;
|
|
|
+ json1["Stat"] = alarmInfo.State;
|
|
|
+ json0["FaceIDList"] = alarmInfo.FaceIDList;
|
|
|
+ json0["FaceNameList"] = alarmInfo.FaceNameList;
|
|
|
+ json0["OnWork"] = alarmInfo.OnWork;
|
|
|
+
|
|
|
+ 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_WARN(m_logger,"插入报警信息失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // SPDLOG_LOGGER_DEBUG(m_logger,"插入报警信息成功!");
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|
|
|
- SPDLOG_LOGGER_DEBUG(m_logger,"插入报警信息成功!");
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -1037,22 +1205,37 @@ bool ToEQMDataBase::updateAlarmEndTime(const AlarmInfo& alarmInfo)
|
|
|
SPDLOG_LOGGER_ERROR(m_logger,"WebApi is nullptr");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson json0;
|
|
|
- json0["opName"] = "SPSS_UpdateAlarmEndTime";
|
|
|
- nJson json1;
|
|
|
- json1["EndTime"] = alarmInfo.EndTime;
|
|
|
- json1["ChannelID"] = alarmInfo.ChannelID;
|
|
|
- json1["RoomID"] = alarmInfo.RoomID;
|
|
|
- json1["CamerID"] = alarmInfo.DeviceID;
|
|
|
- json1["ActionID"] = alarmInfo.ActionID;
|
|
|
- json0["paramList"] = json1;
|
|
|
-
|
|
|
- QString strCmd = QString::fromStdString(json0.dump());
|
|
|
- QString strRet;
|
|
|
- int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ try
|
|
|
{
|
|
|
- SPDLOG_LOGGER_WARN(m_logger,"更新报警结束时间失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ nJson json0;
|
|
|
+ json0["opName"] = "SPSS_UpdateAlarmEndTime";
|
|
|
+ nJson json1;
|
|
|
+ json1["EndTime"] = alarmInfo.EndTime;
|
|
|
+ json1["ChannelID"] = alarmInfo.ChannelID;
|
|
|
+ json1["RoomID"] = alarmInfo.RoomID;
|
|
|
+ json1["CamerID"] = alarmInfo.DeviceID;
|
|
|
+ json1["ActionID"] = alarmInfo.ActionID;
|
|
|
+ json0["paramList"] = json1;
|
|
|
+
|
|
|
+ QString strCmd = QString::fromStdString(json0.dump());
|
|
|
+ QString strRet;
|
|
|
+ int ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Update, strCmd, strRet);
|
|
|
+ if(ret != 0)
|
|
|
+ {
|
|
|
+ SPDLOG_LOGGER_WARN(m_logger,"更新报警结束时间失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
@@ -1067,7 +1250,7 @@ bool ToEQMDataBase::getPersonCountRuleInfo(std::vector<PersonCountRuleInfo>& vec
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取AlarmRule失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -1141,7 +1324,7 @@ bool ToEQMDataBase::getAlarmAppInfo(std::list<AppAndTimeInfo>& listInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_DEBUG(m_logger,"获取AlarmApp失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|
|
@@ -1235,7 +1418,7 @@ bool ToEQMDataBase::insertOnWorkInfo(const RoomFaceInfo& onWorkInfo)
|
|
|
QString strCmd = QString::fromStdString(json0.dump());
|
|
|
QString strRet;
|
|
|
auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
|
|
|
- if(ret < 0)
|
|
|
+ if(ret != 0)
|
|
|
{
|
|
|
SPDLOG_LOGGER_WARN(m_logger,"插入 tWorkOnInfo 失败:{}, 错误信息:{}",ret,m_httpApi->DoGetLastError(&ret).toStdString());
|
|
|
return false;
|