#include "module_meta_date_changed.h" #include"module_attendance_person.h" #include"module_attendance_vehicle.h" #include"ant.h" void module_meta_date_changed::deal_call_edit_vehicle(int64_t id64, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { card_list::instance()->init_vehicle(id64); } else if(ET_DELETE == edit_type_id) { auto str = tool_other::to13str(id64); remove_card(tool_other::id64_to_id(str), tool_other::id64_to_type(str)); } } void module_meta_date_changed::deal_call_edit_staff(int64_t id64, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { card_list::instance()->init_staffer(id64); } else if(ET_DELETE == edit_type_id) { auto str = tool_other::to13str(id64); remove_card(tool_other::id64_to_id(str), tool_other::id64_to_type(str)); } } void module_meta_date_changed::deal_call_edit_card(int64_t id64, EDIT_TYPE_ID edit_type_id) { std::string card_id64_str = tool_other::to13str(static_cast(id64)); int type = tool_other::id64_to_type(card_id64_str); if(tool_other::is_person(type)) { deal_call_edit_staff(id64, edit_type_id); } else if(tool_other::is_vehicle(type)) { deal_call_edit_vehicle(id64, edit_type_id); } else { log_error("基础数据 删除卡type不对:type=%d", type); } } void module_meta_date_changed::deal_call_edit_area(int id, EDIT_TYPE_ID edit_type_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); } } 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); } } void module_meta_date_changed::deal_call_edit_reader(int id, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { sit_list::instance()->init_site(id); } else if(ET_DELETE == edit_type_id) { //删除告警 sit_list::instance()->remove(id); } } void module_meta_date_changed::deal_call_edit_antenna(int id,EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { sit_list::instance()->read_sit_list(id); } else if(ET_DELETE == edit_type_id) { delete_antenna(id); } } void module_meta_date_changed::deal_call_edit_path(int id, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id) { log_error("path不支持增加操作"); std_debug("path不支持增加操作"); } else if(ET_UPDATE == edit_type_id) { sit_list::instance()->read_ant_path(id); } else if(ET_DELETE == edit_type_id) { auto sit_ptr = sit_list::instance()->get(id); if(sit_ptr) { sit_ptr->clear_path(); } log_info("path删除成功,分站id=%d", id); std_debug("path删除成功,分站id=%d", id); } } void module_meta_date_changed::deal_call_edit_map(int id, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { if(!is_cur_map(id)) { log_info("修改的不是当前使用的地图,要修改地图id=%d,当前使用地图id=%d", id, cur_map_id()); return; } update_map_info(id); } else if(ET_DELETE == edit_type_id) { if(is_cur_map(id)) { log_error("删除了当前使用的地图"); return; } } } void module_meta_date_changed::deal_call_edit_light(int id, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { } else if(ET_DELETE == edit_type_id) { } } void module_meta_date_changed::deal_call_edit_lights_group(int id, EDIT_TYPE_ID edit_type_id) { if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id) { } else if(ET_DELETE == edit_type_id) { } } void module_meta_date_changed::init_setting() { //pRes = getMysqlRes("select setting_id, name, type, value from dat_setting;"); } void module_meta_date_changed::remove_card(uint32_t id, int32_t type) { uint64_t card_id = tool_other::type_id_to_u64(type, id); auto card_ptr = card_list::instance()->get(card_id); if(!card_ptr) { log_error("基础数据, 在全局列表中删除卡,全局列表中已经不存在此卡, id=%d, type=%d", id, type); return; } auto area_hover_ptr = card_ptr->get_area_hover(); if(area_hover_ptr && 0!=area_hover_ptr->id() && 0!=area_hover_ptr->mapid()) { module_area::on_leave(card_ptr->m_id, area_hover_ptr, card_ptr->m_type); } if(card_ptr->is_person()) { module_attendance_person::up_mine(card_ptr, nullptr); } else { module_attendance_vehicle::save_attendance(card_ptr, nullptr); module_meta_date_changed::clear_card(card_ptr); } // 避免状态重置 card_list::instance()->remove(card_id); log_info("基础数据, 在全局列表中删除卡成功, id=%d, type=%d", id, type); }