mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
调试修改MQTT通讯解析
This commit is contained in:
@@ -48,6 +48,7 @@ bool AppData::initFromDB()
|
||||
{ // 数据库读取工作模式定义
|
||||
str = "", result.clear();
|
||||
DAO::queryWorkModeDef(dao, result);
|
||||
this->mapping.workMode.clear();
|
||||
for (auto& fields: result)
|
||||
{
|
||||
int workModeId = fields.get<int>(DMDefWorkMode::WORK_MODE_ID);
|
||||
@@ -61,6 +62,7 @@ bool AppData::initFromDB()
|
||||
{ // 数据库读取策略类型定义
|
||||
str = "", result.clear();
|
||||
DAO::queryPolicyTypeDef(dao, result);
|
||||
this->mapping.policyType.clear();
|
||||
for (auto& fields: result)
|
||||
{
|
||||
int policyTypeId = fields.get<int>(DMDefPolicyType::POLICY_TYPE_ID);
|
||||
@@ -74,6 +76,7 @@ bool AppData::initFromDB()
|
||||
{ // 数据库读取设备类型定义
|
||||
str = "", result.clear();
|
||||
DAO::queryDeviceTypeDef(dao, result);
|
||||
mapping.deviceType.clear();
|
||||
for (auto& fields: result)
|
||||
{
|
||||
auto item = std::make_shared<DeviceType>();
|
||||
@@ -90,8 +93,8 @@ bool AppData::initFromDB()
|
||||
}
|
||||
{ // 数据库读取角色定义
|
||||
str = "", result.clear();
|
||||
this->mapping.role.clear();
|
||||
DAO::queryRoleList(dao, result);
|
||||
this->mapping.role.clear();
|
||||
for (auto& fields : result)
|
||||
{
|
||||
auto item = std::make_shared<Role>();
|
||||
@@ -108,19 +111,20 @@ bool AppData::initFromDB()
|
||||
str = "", result.clear();
|
||||
std::string sql = "SELECT s.*, p.name policy_name, p.`type` policy_type, p.value FROM station s LEFT JOIN policy p ON s.policy_id=p.policy_id;";
|
||||
dao->exec(sql, result);
|
||||
this->mapping.stationName.clear();
|
||||
for (auto& fields: result)
|
||||
{
|
||||
auto station = std::make_shared<Station>();
|
||||
station->setFields(fields);
|
||||
this->mapStation[station->stationId] = station;
|
||||
mapping.stationName.push_back({std::to_string(station->stationId), station->name});
|
||||
this->mapping.stationName.push_back({std::to_string(station->stationId), station->name});
|
||||
str += ("场站: {" + std::to_string(station->stationId) + ":" + station->name + "},");
|
||||
}
|
||||
spdlog::info(str);
|
||||
}
|
||||
{ // 数据库读取设备信息
|
||||
str = "", result.clear();
|
||||
DAO::queryDeviceList(dao, result);
|
||||
DAO::queryDeviceList(dao, result, 1);
|
||||
for (auto& fields: result)
|
||||
{
|
||||
int deviceId = fields.get<int>(DMDevice::DEVICE_ID);
|
||||
@@ -135,6 +139,10 @@ bool AppData::initFromDB()
|
||||
spdlog::error("init device error: unknown station_id:, device_id=", stationId, deviceId);
|
||||
}
|
||||
}
|
||||
for (auto& item : mapStation)
|
||||
{
|
||||
item.second->groupDevice();
|
||||
}
|
||||
}
|
||||
{ // 数据库读取策略信息
|
||||
str = "", result.clear();
|
||||
|
||||
Reference in New Issue
Block a user