add qvvr interface
This commit is contained in:
@@ -1149,32 +1149,24 @@ static void scanAndResendOfflineFiles(const std::string& dirPath)
|
||||
}
|
||||
}
|
||||
|
||||
int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
double mag, double dur, long long start_tm, long long end_tm, int dis_kind,
|
||||
const std::string& uuid_cfg, const std::string& uuid_dat,
|
||||
const std::string& mp_id, const std::string& Qvvr_rptname, const std::string& devtype) {
|
||||
int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
double mag, double dur, long long start_tm, int dis_kind,int phase,
|
||||
const std::string& wavepath) {
|
||||
|
||||
// 监测点日志的 key, lnk20250526
|
||||
std::string full_key_m_c = "monitor." + mp_id + ".COM";
|
||||
std::string full_key_m_d = "monitor." + mp_id + ".DATA";
|
||||
std::string full_key_m_c = "monitor." + std::to_string(monitor_id) + ".COM";
|
||||
std::string full_key_m_d = "monitor." + std::to_string(monitor_id) + ".DATA";
|
||||
// 监测点日志的 key, lnk20250526
|
||||
|
||||
// 获取装置类型的映射配置
|
||||
XmlConfig c_xmlcfg;
|
||||
if (xmlinfo_list.count(devtype)) {
|
||||
c_xmlcfg = xmlinfo_list[devtype]->xmlcfg;
|
||||
} else {
|
||||
c_xmlcfg = xmlcfg;
|
||||
}
|
||||
|
||||
if (mp_id.empty()) {
|
||||
std::cout << "mp_id is null" << std::endl;
|
||||
if (dev_id.empty()) {
|
||||
std::cout << "dev_id is null" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 构造 JSON 对象
|
||||
json root;
|
||||
root["monitorId"] = mp_id;
|
||||
root["devId"] = dev_id;
|
||||
root["CpuNo"] = monitor_id;
|
||||
root["amplitude"] = mag;
|
||||
root["duration"] = dur;
|
||||
root["eventType"] = dis_kind;
|
||||
@@ -1189,21 +1181,9 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
std::string start_time_str = start_time_stream.str();
|
||||
|
||||
root["startTime"] = start_time_str;
|
||||
root["wavePath"] = uuid_dat; //接口提供了两个文件名入参,实际上名字一样只用一个,可优化
|
||||
root["wavePath"] = wavepath;
|
||||
root["phase"] = phase;
|
||||
|
||||
if (c_xmlcfg.WavePhasicFlag == "1") { //映射配置分相
|
||||
if (Qvvr_rptname.find(c_xmlcfg.WavePhasicA) != std::string::npos) {
|
||||
root["phase"] = "A";
|
||||
} else if (Qvvr_rptname.find(c_xmlcfg.WavePhasicB) != std::string::npos) {
|
||||
root["phase"] = "B";
|
||||
} else if (Qvvr_rptname.find(c_xmlcfg.WavePhasicC) != std::string::npos) {
|
||||
root["phase"] = "C";
|
||||
} else {
|
||||
root["phase"] = "unknow";
|
||||
}
|
||||
} else {
|
||||
root["phase"] = "unknow"; //不分相
|
||||
}
|
||||
|
||||
std::string json_string = root.dump(4);
|
||||
std::cout << json_string << std::endl;
|
||||
@@ -1212,7 +1192,7 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
std::string response;
|
||||
SendJsonAPI_web(WEB_EVENT, "", json_string, response);
|
||||
|
||||
// ================ 插入新功能 =========================
|
||||
// ================ 暂态重发功能 =========================
|
||||
if (!response.empty()) {
|
||||
try {
|
||||
json j_r = json::parse(response);
|
||||
@@ -1254,13 +1234,7 @@ int transfer_json_qvvr_data(unsigned int func_type, int monitor_id,
|
||||
|
||||
void qvvr_test()
|
||||
{
|
||||
char uuid_cfg[] = {"/comtrade/"};
|
||||
char uuid_dat[] = {"/comtrade/"};
|
||||
char mp_id[] = {"qvvrtest123"};
|
||||
char Qvvr_rptname[] = {"unknow"};
|
||||
char devtype[] = {"01"};
|
||||
|
||||
transfer_json_qvvr_data(1, 123456789, 220, 180, 1730894400.123, 1730894580, 1210001,uuid_cfg,uuid_dat,mp_id,Qvvr_rptname,devtype);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////通用接口响应
|
||||
|
||||
Reference in New Issue
Block a user