实现策略配置功能

This commit is contained in:
lixiaoyuan
2025-08-28 18:42:37 +08:00
parent 8f6c83147b
commit dda905cda0
47 changed files with 1311 additions and 863 deletions

View File

@@ -5,6 +5,7 @@
#include <memory>
#include <map>
#include <unordered_map>
#include "common/Fields.h"
class Station;
class Device;
@@ -16,7 +17,9 @@ struct DeviceType
{
int typeId {};
std::string name;
std::string attrs;
std::string group;
std::string attr;
Fields fieldsAttr;
};
struct Role
@@ -47,20 +50,27 @@ public:
void init();
void initFromDB();
std::shared_ptr<Station> getStation(int stationId);
std::shared_ptr<Station> getStationByName(std::string name);
std::shared_ptr<Device> getDevice(int stationId, int deviceId);
// 获取设备类型定义
std::unordered_map<int, std::shared_ptr<DeviceType>>& getDeviceTypeDef();
// 读取统计数据: 今日统计数据,累计统计数据
void loadStatData();
void initUser();
std::shared_ptr<Station> getStation(int stationId);
std::shared_ptr<Station> getStationByName(std::string name);
std::shared_ptr<Device> getDevice(int stationId, int deviceId);
std::string getDeviceNameById(int typeId);
// 获取设备类型定义
std::shared_ptr<DeviceType> getDeviceTypeDef(int typeId);
int getWorkModeIdByName(std::string name);
///////////////////////////////////////////////////////////////////////////////////////////////
// 获取角色名称列表
std::vector<std::string> getRoleNames();
@@ -74,6 +84,9 @@ public:
std::vector<std::string> getPolicyTypeNames();
// 获取策略名称
std::vector<std::string> getPolicyNames();
// 根据策略类型ID获取策略类型名称
// 根据策略类型名称获取策略类型ID
int getPolicyTypeId(std::string name);
std::vector<std::string> getElectPreiodVals(int month);
@@ -103,6 +116,9 @@ public:
VecPairSS deviceType;
VecPairSS workMode;
VecPairSS policyType;
VecPairSS stationName;
} mapping;
double electPriceSuperPeak {};