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:
@@ -524,13 +524,14 @@ Errcode DAO::insertSystemLogUser(std::string token, std::string content, int sta
|
||||
fields.set("user_account", user.account);
|
||||
return DAO::insertSystemLog(fields);
|
||||
}
|
||||
Errcode DAO::insertSystemLogDevice(std::string deviceId, std::string content, int status)
|
||||
Errcode DAO::insertSystemLogDevice(int stationId, int deviceId, std::string content, int status)
|
||||
{
|
||||
Fields fields;
|
||||
fields.set("station_id", stationId);
|
||||
fields.set("device_id", deviceId);
|
||||
fields.set("type", 3);
|
||||
fields.set("content", content);
|
||||
fields.set("status", status);
|
||||
fields.set("device_id", deviceId);
|
||||
return DAO::insertSystemLog(fields);
|
||||
}
|
||||
|
||||
@@ -576,7 +577,6 @@ Errcode DAO::queryStatStationGroup(std::shared_ptr<DaoEntity> dao, string statio
|
||||
if (!sqlCondition.empty()) { sqlCondition = " WHERE " + sqlCondition; }
|
||||
|
||||
std::string sql = R"(SELECT dt,
|
||||
SUM(ss.storage_elect_in) storage_elect_in,
|
||||
SUM(storage_elect_in) storage_elect_in,
|
||||
SUM(storage_elect_out) storage_elect_out,
|
||||
SUM(storage_num_in) storage_num_in,
|
||||
@@ -592,7 +592,7 @@ Errcode DAO::queryStatStationGroup(std::shared_ptr<DaoEntity> dao, string statio
|
||||
AVG(charge_usage) charge_usage,
|
||||
SUM(income_elect) income_elect,
|
||||
SUM(income_charge) income_charge
|
||||
FROM stat_station ss)" + sqlCondition + "GROUP by dt;";
|
||||
FROM stat_day)" + sqlCondition + " GROUP by dt;";
|
||||
return DAO::exec(dao, sql, result);
|
||||
}
|
||||
|
||||
@@ -621,7 +621,7 @@ Errcode DAO::queryStatStationList(PageInfo& pageInfo, Fields& params, vector<Fie
|
||||
if (!sqlCondition.empty()) { sqlCondition = " WHERE " + sqlCondition; }
|
||||
|
||||
std::string sqlFields = "ss.*, d.name device_name, ddt.name device_type";
|
||||
std::string sqlFrom = R"(FROM stat_station ss
|
||||
std::string sqlFrom = R"(FROM stat_day ss
|
||||
LEFT JOIN device d ON d.device_id = ss.device_id
|
||||
LEFT JOIN def_device_type ddt ON ddt.device_type_id = d.`type`)" + sqlCondition;
|
||||
|
||||
@@ -643,7 +643,8 @@ Errcode DAO::queryPolicyTypeDef(std::shared_ptr<DaoEntity> dao, vector<Fields>&
|
||||
Errcode DAO::insertStatStation(std::shared_ptr<DaoEntity> dao, Fields& fields)
|
||||
{
|
||||
// 根据主键(dt、station_id、category),写入或更新数据
|
||||
if (!dao) { dao = DaoEntity::create("stat_station"); }
|
||||
if (!dao) { dao = DaoEntity::create("stat_day"); }
|
||||
else { dao->setTableName("stat_day"); }
|
||||
std::vector<std::string> vecKeys = {
|
||||
"storage_elect_in",
|
||||
"storage_elect_out",
|
||||
|
||||
Reference in New Issue
Block a user