现在可以只开日志并保留台账更新和进程控制
This commit is contained in:
@@ -248,6 +248,9 @@ std::string FRONT_INST;//lnk20250512改为string
|
|||||||
char* FRONT_IP;
|
char* FRONT_IP;
|
||||||
int CITY_FLAG;
|
int CITY_FLAG;
|
||||||
|
|
||||||
|
//lnk20260309添加一个全局变量,标志是否只运行补招程序
|
||||||
|
int RECALL_ONLY_FLAG;
|
||||||
|
|
||||||
int recall_len;
|
int recall_len;
|
||||||
int recall_sta;
|
int recall_sta;
|
||||||
int recall_daily;
|
int recall_daily;
|
||||||
@@ -449,6 +452,10 @@ void init_config() {
|
|||||||
CITY_FLAG = settings.value("Flag/CityFlag", 0).toInt();
|
CITY_FLAG = settings.value("Flag/CityFlag", 0).toInt();
|
||||||
qDebug() << "Read CITY_FLAG:" << CITY_FLAG << endl;
|
qDebug() << "Read CITY_FLAG:" << CITY_FLAG << endl;
|
||||||
|
|
||||||
|
//lnk20260309添加一个全局变量,标志是否只运行补招程序
|
||||||
|
RECALL_ONLY_FLAG = settings.value("Flag/RecallOnlyFlag", 0).toInt();
|
||||||
|
qDebug() << "Read RECALL_ONLY_FLAG:" << RECALL_ONLY_FLAG << endl;
|
||||||
|
|
||||||
//台账配置lnk20241031//////////////////////////////////////////////////////////////
|
//台账配置lnk20241031//////////////////////////////////////////////////////////////
|
||||||
TERMINAL_STATUS = settings.value("Ledger/TerminalStatus", 0).toString().toStdString();
|
TERMINAL_STATUS = settings.value("Ledger/TerminalStatus", 0).toString().toStdString();
|
||||||
std::cout << "Read TERMINAL_STATUS:" << TERMINAL_STATUS << std::endl;
|
std::cout << "Read TERMINAL_STATUS:" << TERMINAL_STATUS << std::endl;
|
||||||
@@ -5242,7 +5249,7 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
|
|||||||
cJSON* json_data = cJSON_Parse(response.c_str());
|
cJSON* json_data = cJSON_Parse(response.c_str());
|
||||||
if (json_data == nullptr) {
|
if (json_data == nullptr) {
|
||||||
std::cerr << "Error parsing response: " << cJSON_GetErrorPtr() << std::endl;
|
std::cerr << "Error parsing response: " << cJSON_GetErrorPtr() << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传暂态录波文件失败,web返回的消息错误,无法解析");
|
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息错误,无法解析");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5288,11 +5295,11 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
|
|||||||
|
|
||||||
std::cout << "wavepath: " << wavepath << std::endl;
|
std::cout << "wavepath: " << wavepath << std::endl;
|
||||||
|
|
||||||
DIY_INFOLOG("process","【NORMAL】前置上传暂态录波文件成功,远端文件名:%s",wavepath);
|
DIY_INFOLOG("process","【NORMAL】前置上传文件成功,远端文件名:%s",wavepath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Error: Missing expected fields in JSON response." << std::endl;
|
std::cerr << "Error: Missing expected fields in JSON response." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传暂态录波文件失败,web返回的消息没有远端文件名");
|
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】前置上传文件失败,web返回的消息没有远端文件名");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 释放 JSON 对象
|
// 释放 JSON 对象
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ extern apr_pool_t* g_init_pool;
|
|||||||
extern int g_DevFlag; //日志配置中读取的参数,暂无特定使用lnk20250121
|
extern int g_DevFlag; //日志配置中读取的参数,暂无特定使用lnk20250121
|
||||||
|
|
||||||
extern int IED_COUNT;
|
extern int IED_COUNT;
|
||||||
|
extern int RECALL_ONLY_FLAG; //lnk20260309添加一个全局变量,标志是否只运行补招程序
|
||||||
|
|
||||||
//lnk20250115end
|
//lnk20250115end
|
||||||
|
|
||||||
@@ -1418,11 +1419,14 @@ void check_ledger_update()//lnk20250113
|
|||||||
//调试用
|
//调试用
|
||||||
print_trigger_update_xml(trigger_ledger_update_xml);
|
print_trigger_update_xml(trigger_ledger_update_xml);
|
||||||
|
|
||||||
//处理台账更新加台账锁lnk20250114
|
//处理台账更新添加控制标志
|
||||||
//pthread_mutex_lock(&mtx); printf("ledgerupdate hold lock !!!!!!!!!!!");
|
if (RECALL_ONLY_FLAG != 1 || (g_node_id != STAT_DATA_BASE_NODE_ID)) {
|
||||||
process_ledger_update(trigger_ledger_update_xml); //台账更新
|
process_ledger_update(trigger_ledger_update_xml); //台账更新
|
||||||
//pthread_mutex_unlock(&mtx); printf("ledgerupdate free lock !!!!!!!!!!!");
|
}
|
||||||
|
else{
|
||||||
|
printf("only process recall config, skip ledger update\n");
|
||||||
|
DIY_WARNLOG_CODE("process",LOG_CODE_SPACE_ALARM,"【WARN】当前配置为仅日志模式,统计数据进程跳过台账更新");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用完后释放动态分配的内存
|
// 使用完后释放动态分配的内存
|
||||||
|
|||||||
@@ -1457,6 +1457,29 @@ ST_VOID u_mvl_ident_ind (MVL_IND_PEND *indCtrl)
|
|||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* getFile */
|
/* getFile */
|
||||||
|
/*
|
||||||
|
先向远端发 fopen,打开远程文件
|
||||||
|
|
||||||
|
拿到这个远程文件会话句柄 frsmid
|
||||||
|
|
||||||
|
循环发 fread,一块一块把远程文件内容读回来并写入本地文件
|
||||||
|
|
||||||
|
最后发 fclose,关闭远程文件
|
||||||
|
|
||||||
|
clientNetInfo:客户端和 MMS 服务器之间的网络连接信息
|
||||||
|
|
||||||
|
loc_file:本地保存的文件路径
|
||||||
|
|
||||||
|
rem_file:远端设备上的文件路径
|
||||||
|
|
||||||
|
iTimeout:每次请求等待响应的超时时间
|
||||||
|
|
||||||
|
返回值:
|
||||||
|
|
||||||
|
SD_SUCCESS:下载成功
|
||||||
|
|
||||||
|
其他:失败错误码
|
||||||
|
*/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
ST_RET mms_getFile (MVL_NET_INFO *clientNetInfo, ST_CHAR *loc_file,
|
ST_RET mms_getFile (MVL_NET_INFO *clientNetInfo, ST_CHAR *loc_file,
|
||||||
ST_CHAR *rem_file, ST_INT iTimeout)
|
ST_CHAR *rem_file, ST_INT iTimeout)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ extern int SOCKET_PORT;
|
|||||||
extern int G_TEST_FLAG;
|
extern int G_TEST_FLAG;
|
||||||
extern int g_front_seg_index;
|
extern int g_front_seg_index;
|
||||||
extern int g_front_seg_num;
|
extern int g_front_seg_num;
|
||||||
|
extern int RECALL_ONLY_FLAG; //lnk20260309添加一个全局变量,标志是否只运行补招程序
|
||||||
|
|
||||||
#include "../rocketmq/SimpleProducer.h"
|
#include "../rocketmq/SimpleProducer.h"
|
||||||
#include "../cfg_parse/custom_printf.h"//lnk20250225
|
#include "../cfg_parse/custom_printf.h"//lnk20250225
|
||||||
@@ -187,42 +188,45 @@ apr_status_t init_rdb()
|
|||||||
init_config();
|
init_config();
|
||||||
GetServerIndexFromDB();
|
GetServerIndexFromDB();
|
||||||
|
|
||||||
rv = parse_device_cfg_web();
|
//只有补招运行时,统计不读取台账和模型
|
||||||
if (rv != APR_SUCCESS) {
|
if (RECALL_ONLY_FLAG != 1 || (g_node_id != STAT_DATA_BASE_NODE_ID)) {
|
||||||
echo_errg("Parsed device config xml file with error,try to run! \n");
|
rv = parse_device_cfg_web();
|
||||||
|
if (rv != APR_SUCCESS) {
|
||||||
|
echo_errg("Parsed device config xml file with error,try to run! \n");
|
||||||
|
|
||||||
//char buf[256];
|
//char buf[256];
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
//log_error("process", buf);
|
//log_error("process", buf);
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER,"【ERROR】前置的%s%d号进程调用web台账接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
//台账读取过后初始化各级的日志
|
//台账读取过后初始化各级的日志
|
||||||
init_loggers();
|
init_loggers();
|
||||||
|
|
||||||
rv = parse_model_cfg_web();
|
|
||||||
if (rv != APR_SUCCESS) {//不可能
|
|
||||||
echo_errg("Parsed model with error,try to run! \n");
|
|
||||||
|
|
||||||
//char buf[256];
|
rv = parse_model_cfg_web();
|
||||||
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
if (rv != APR_SUCCESS) {//不可能
|
||||||
//log_error("process", buf);
|
echo_errg("Parsed model with error,try to run! \n");
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
|
||||||
|
|
||||||
return rv;
|
//char buf[256];
|
||||||
}
|
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
//log_error("process", buf);
|
||||||
|
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置的%s%d号进程调用web模型接口失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
Set_xml_nodeinfo();//解析xml模型
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
rv = parse_rpt_log_ini();//报告块初始化
|
Set_xml_nodeinfo();//解析xml模型
|
||||||
if (rv != APR_SUCCESS) {
|
|
||||||
echo_errg("Failed to parse report log define ini file! \n");
|
|
||||||
|
|
||||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RPTINIT,"【ERROR】前置的%s%d号进程报告初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
rv = parse_rpt_log_ini();//报告块初始化
|
||||||
|
if (rv != APR_SUCCESS) {
|
||||||
|
echo_errg("Failed to parse report log define ini file! \n");
|
||||||
|
|
||||||
return rv;
|
DIY_ERRORLOG_CODE("process",LOG_CODE_RPTINIT,"【ERROR】前置的%s%d号进程报告初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app_get_private_config(g_my_conf_fname) != APR_SUCCESS) {
|
if (app_get_private_config(g_my_conf_fname) != APR_SUCCESS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user