mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
新增http、mqtt运行库,实现mqtt功能, 新增spdlog
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "database/Dao.h"
|
||||
#include "common/JsonN.h"
|
||||
#include "common/Snowflake.h"
|
||||
#include "common/Spdlogger.h"
|
||||
|
||||
|
||||
void ElectPeriod::parse(std::string jsonstr)
|
||||
@@ -39,7 +40,7 @@ void AppData::initFromDB()
|
||||
auto dao = DaoEntity::create("");
|
||||
if (!dao->isConnected())
|
||||
{
|
||||
XLOGE() << "Database connected error.";
|
||||
spdlog::info("Database connected error.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ void AppData::initFromDB()
|
||||
this->mapWorkMode[workModeId] = name;
|
||||
str += ("工作模式: {" + std::to_string(workModeId)+":" + name + "},");
|
||||
}
|
||||
XLOGD() << str;
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取策略类型定义
|
||||
str = "", result.clear();
|
||||
@@ -70,7 +71,7 @@ void AppData::initFromDB()
|
||||
this->mapPolicyType[policyTypeId] = name;
|
||||
str += ("策略类型: {" + std::to_string(policyTypeId) + ":" + name + "},");
|
||||
}
|
||||
XLOGD() << str;
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取设备类型定义
|
||||
str = "", result.clear();
|
||||
@@ -87,7 +88,7 @@ void AppData::initFromDB()
|
||||
mapping.deviceType.push_back({std::to_string(item->typeId), item->name});
|
||||
str += ("设备类型: {" + std::to_string(item->typeId) + ":" + item->name + "},");
|
||||
}
|
||||
XLOGD() << str;
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取角色定义
|
||||
str = "", result.clear();
|
||||
@@ -103,7 +104,7 @@ void AppData::initFromDB()
|
||||
mapping.role.push_back({std::to_string(item->roleId), item->name});
|
||||
str += ("角色: {" + std::to_string(item->roleId) + ":" + item->name + "},");
|
||||
}
|
||||
XLOGD() << str;
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取场站信息
|
||||
str = "", result.clear();
|
||||
@@ -116,7 +117,7 @@ void AppData::initFromDB()
|
||||
mapping.stationName.push_back({std::to_string(station->id), station->name});
|
||||
str += ("场站: {" + std::to_string(station->id) + ":" + station->name + "},");
|
||||
}
|
||||
XLOGD() << str;
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取设备信息
|
||||
str = "", result.clear();
|
||||
@@ -135,7 +136,7 @@ void AppData::initFromDB()
|
||||
}
|
||||
else
|
||||
{
|
||||
XLOGE() << "init device error: unknown station_id:[" << stationId << "] device_id=" << deviceId;
|
||||
spdlog::error("init device error: unknown station_id:, device_id=", stationId, deviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +208,7 @@ void AppData::initFromDB()
|
||||
}
|
||||
else
|
||||
{
|
||||
XLOGE() << "init staticis data error: unknown station_id:[" << stationId << "] dt=" << dt;
|
||||
spdlog::error("init staticis data error: unknown station_id:{}, dt={}", stationId, dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,6 +228,10 @@ std::shared_ptr<Station> AppData::getStation(int stationId)
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
int AppData::getStationCount()
|
||||
{
|
||||
return mapStation.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Station> AppData::getStationByName(std::string name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user