This commit is contained in:
lnk
2025-09-22 16:46:33 +08:00
parent 169aa9b34a
commit db8aa8c07d
8 changed files with 358 additions and 252 deletions

View File

@@ -1176,14 +1176,22 @@ static void scanAndResendOfflineFiles(const std::string& dirPath)
}
}
// 0->"A", 1->"B", 2->"C", 3->"AB", 4->"BC", 5->"CA", 6/其它->"ABC"
inline std::string phase_to_text(int phase) {
switch (phase) {
case 0: return "A";
case 1: return "B";
case 2: return "C";
case 3: return "AB";
case 4: return "BC";
case 5: return "CA";
default: return "ABC"; // 包含 6 和其他任何值
}
}
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." + dev_id + "." + std::to_string(monitor_id) + ".COM";
std::string full_key_m_d = "monitor." + dev_id + "." + std::to_string(monitor_id) + ".DATA";
// 监测点日志的 key, lnk20250526
if (dev_id.empty()) {
std::cout << "qvvr send error ,dev_id is null" << std::endl;
@@ -1219,8 +1227,8 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
std::string start_time_str = start_time_stream.str();
root["startTime"] = start_time_str;
root["wavePath"] = wavepath;
root["phase"] = phase;
root["wavePath"] = wavepath;
root["phase"] = phase_to_text(phase);
std::string json_string = root.dump(4);
@@ -1237,7 +1245,7 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
// 有效响应,略过
} catch (...) {
// 响应异常,保存 json
DIY_ERRORLOG(full_key_m_d.c_str(), "【ERROR】暂态接口响应异常,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
DIY_ERRORLOG(mpid.c_str(), "【ERROR】暂态接口响应异常,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
std::cout << "qvvr send fail ,store in local" << std::endl;
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
@@ -1247,7 +1255,7 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
}
} else {
// 无响应,保存 json
DIY_ERRORLOG(full_key_m_d.c_str(), "【ERROR】暂态接口无响应,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
DIY_ERRORLOG(mpid.c_str(), "【ERROR】暂态接口无响应,无法上送装置%s监测点%s的暂态事件",dev_id, monitor_id);
std::cout << "qvvr send fail ,store in local" << std::endl;
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";