1.新增服务端UI界面,显示服务基础信息。2.修改设备显示配置。3.监控页面储能系统显示储能模式,模式设置新增'手动'

This commit is contained in:
lixiaoyuan
2025-09-25 19:20:25 +08:00
parent d7888c2be4
commit 8aba56f47d
39 changed files with 2954 additions and 408 deletions

View File

@@ -657,6 +657,16 @@ Errcode HttpEntity::updateStation(const httplib::Request& req, njson& json, std:
}
}
}
if (params.contains("station_id") && params.contains("work_mode"))
{
int stationId = params.get<int>("station_id");
int workmode = params.get<int>("work_mode");
auto station = Application::data().getStation(stationId);
if (station)
{
station->setGarewayWorkMode();
}
}
return err;
};
@@ -702,6 +712,9 @@ Errcode HttpEntity::queryStationOverview(const httplib::Request& req, njson& jso
return Errcode(ret);
}
njson jsonStorage = njson::parse(R"({"category":1, "gateway":0, "count":0, "power":0.0})");
auto station = Application::data().getStation(Utils::toInt(stationId));
jsonStorage["workmode"] = station ? station->getGatewayMode() : "--";
njson jsonCharge = njson::parse(R"({"category":2, "count":0, "power":0.0})");
njson jsonSolar = njson::parse(R"({"category":3, "count":0, "power":0.0})");
njson jsonSecurity = njson::parse(R"({"category":4, "count":0, "power":0.0})");
@@ -1252,6 +1265,13 @@ Errcode HttpEntity::queryStatDayList(const httplib::Request& req, njson& json, s
if (!startDate.empty() && !endDate.empty())
{
std::map<std::string, Fields*> mapTemp;
for (auto& item: result)
{
auto& dt = item.value("dt");
mapTemp[dt] = &item;
}
int64_t t0 = Utils::time(startDate + " 00:00:00");
int64_t t1 = Utils::time(endDate + " 00:00:00");
int i = 0;
@@ -1262,11 +1282,9 @@ Errcode HttpEntity::queryStatDayList(const httplib::Request& req, njson& json, s
njson jsonrow;
std::string dt = Utils::dateStr(t);
Fields* fields = NULL;
if (i<result.size() && result[i].value("dt") == dt)
{
fields = &(result[i]);
i++;
}
auto iter = mapTemp.find(dt);
if (iter != mapTemp.end()) { fields = iter->second; }
jsonrow["dt"] = dt.substr(5);
jsonrow["storage_elect_in"] = fields ? fields->value("storage_elect_in") : "0";
jsonrow["storage_elect_out"] = fields ? fields->value("storage_elect_out") : "0";