|
@@ -27,14 +27,14 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
}
|
|
|
|
|
|
|
|
|
- int64_t id=-1;
|
|
|
- tool_map::try_get_value(id, JSON_KEY_ID, data);
|
|
|
std::string szParam = "0";
|
|
|
tool_map::try_get_value(szParam,JSON_KEY_ID,data);
|
|
|
+ int id = std::stoi(szParam);
|
|
|
|
|
|
std::string op_type="";
|
|
|
tool_map::try_get_value(op_type, JSON_KEY_OP_TYPE, data);
|
|
|
- if((-1 != id || szParam != "0") && !op_type.empty())
|
|
|
+
|
|
|
+ if(!szParam.empty() && !op_type.empty())
|
|
|
{
|
|
|
EDIT_TYPE_ID edit_type_id;
|
|
|
if(!try_get_edit_type_id(op_type, edit_type_id))
|
|
@@ -42,8 +42,8 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
log_error("web发来的数据: 基础数据op_type字段错误:op_type=%s", op_type.c_str());
|
|
|
return;
|
|
|
}
|
|
|
- log_info("基础数据 receive meta_data_changed: %s, id=%d-%s, op_type=%d"
|
|
|
- , name.c_str(), id,szParam.c_str() , edit_type_id);
|
|
|
+ log_info("基础数据 receive meta_data_changed: %s, id=%s, op_type=%d"
|
|
|
+ , name.c_str(), szParam.c_str() , edit_type_id);
|
|
|
|
|
|
if(JSON_KEY_NAME_VEHICLE == name || JSON_KEY_NAME_VEHICLE_EXTEND == name)
|
|
|
{
|
|
@@ -59,7 +59,7 @@ void module_meta_date_changed::accept(sio::message::ptr const& data)
|
|
|
}
|
|
|
else if(JSON_KEY_NAME_AREA == name)
|
|
|
{
|
|
|
- deal_call_edit_area(id, edit_type_id);
|
|
|
+ deal_call_edit_area(szParam, edit_type_id);
|
|
|
}
|
|
|
else if(JSON_KEY_NAME_READER == name)
|
|
|
{
|
|
@@ -176,30 +176,22 @@ void module_meta_date_changed::deal_call_edit_card(std::string & id64, EDIT_TYPE
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void module_meta_date_changed::deal_call_edit_area(int id, EDIT_TYPE_ID edit_type_id)
|
|
|
+void module_meta_date_changed::deal_call_edit_area(const std::string& id, EDIT_TYPE_ID edit_type_id)
|
|
|
{
|
|
|
+ int aid=std::stoi(id);
|
|
|
if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
|
|
|
{
|
|
|
- if(is_monkeycar_area(id))
|
|
|
- {
|
|
|
- area_list::instance()->init_monkeycar_area(id);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- area_list::instance()->init_from_db(id);
|
|
|
- }
|
|
|
+ area_list::instance()->init_from_db(aid);
|
|
|
}
|
|
|
else if(ET_DELETE == edit_type_id)
|
|
|
{
|
|
|
- auto area_ptr = area_list::instance()->get(id);
|
|
|
- if(!area_ptr)
|
|
|
- {
|
|
|
- log_info("区域已经删除:areaid=%d", id);
|
|
|
- return;
|
|
|
- }
|
|
|
- //删除告警
|
|
|
- delete_area_event(area_ptr);
|
|
|
- area_list::instance()->remove(id);
|
|
|
+ area_list::instance()->remove(aid);
|
|
|
+ // auto area_ptr = area_list::instance()->get(aid);
|
|
|
+ // if(!area_ptr)
|
|
|
+ // {
|
|
|
+ // log_info("区域已经删除:areaid=%d", aid);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -211,8 +203,6 @@ void module_meta_date_changed::deal_call_edit_reader(int id, EDIT_TYPE_ID edit_t
|
|
|
}
|
|
|
else if(ET_DELETE == edit_type_id)
|
|
|
{
|
|
|
- //删除告警
|
|
|
-
|
|
|
sit_list::instance()->remove(id);
|
|
|
}
|
|
|
}
|
|
@@ -383,29 +373,14 @@ bool module_meta_date_changed::try_get_edit_type_id(const std::string& op_type,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-bool module_meta_date_changed::is_monkeycar_area(int area_id)
|
|
|
-{
|
|
|
- char sql[1024] = {'\0'};
|
|
|
- sprintf(sql,"select monkeycar_areaid from dat_monkeycar_base_info where monkeycar_areaid=%d;", area_id);
|
|
|
- std::string Error;
|
|
|
- YADB::CDBResultSet DBRes;
|
|
|
- sDBConnPool.Query(sql,DBRes,Error);
|
|
|
- int64_t nCount = DBRes.GetRecordCount( Error );
|
|
|
-
|
|
|
- log_info("monkeycar_area区域查询:nCount=%d,sql=%s", nCount, sql);
|
|
|
- std_debug("monkeycar_area区域查询:nCount=%d,sql=%s", nCount, sql);
|
|
|
-
|
|
|
- return (nCount > 0);
|
|
|
-}
|
|
|
-
|
|
|
///删除区域所有报警信息
|
|
|
-void module_meta_date_changed::delete_area_event(std::shared_ptr<area> area_ptr)
|
|
|
-{
|
|
|
- for(int i=0; i < CARD_EVENT_COUNT_MAX; i++ )
|
|
|
- {
|
|
|
- event_tool::instance()->handle_event(OT_AREA, static_cast<EVENT_TYPE>(i), area_ptr->id(), 0, 0, false);
|
|
|
- }
|
|
|
-}
|
|
|
+//void module_meta_date_changed::delete_area_event(std::shared_ptr<area> area_ptr)
|
|
|
+//{
|
|
|
+// for(int i=0; i < CARD_EVENT_COUNT_MAX; i++ )
|
|
|
+// {
|
|
|
+// event_tool::instance()->handle_event(OT_AREA, static_cast<EVENT_TYPE>(i), area_ptr->id(), 0, 0, false);
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
void module_meta_date_changed::delete_antenna(int id)
|
|
|
{
|