123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifndef MODULE_AREA_H
- #define MODULE_AREA_H
- /**
- * @brief 与区域相关的业务模块总接口
- * @author 戴月腾
- * @date 2018-08-25
- */
- #include"area.h"
- #include"module_const.h"
- #include"module_web.h"
- #include"module_attendance_vehicle.h"
- #include"module_area_over_person.h"
- #include"module_area_timeout_person.h"
- class module_area: public singleton_base<module_area>
- {
- private:
- friend class singleton_base<module_area>;
- module_area()
- {
- }
- public:
- static void on_enter(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
- {
- auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
- if(!card_ptr)
- {
- log_error("卡不存在card_id=%d", card_id);
- return;
- }
- if(card_ptr->is_person())//统计人卡
- {
- c->m_area->m_person_count++;
- //区域人卡超员
- module_area_over_person::instance()->on_enter(card_ptr, c);
- //区域人卡超时
- module_area_timeout_person::instance()->on_enter(card_ptr, c);
- }
- if(card_ptr->is_vehicle())//统计车卡
- {
- c->m_area->m_vehicle_count++;
- //车卡考勤
- module_attendance_vehicle::instance()->on_enter(card_ptr, c);
- }
- }
- static void on_hover(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
- {
- auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
- if(!card_ptr)
- {
- log_error("卡不存在card_id=%d", card_id);
- return;
- }
- if(card_ptr->is_person())//人卡
- {
- //区域人卡超时
- module_area_timeout_person::instance()->on_hover(card_ptr, c);
- }
- if(card_ptr->is_vehicle())//车卡
- {
- }
- }
- static void on_leave(uint32_t card_id, std::shared_ptr<area_hover>&c, int32_t type)
- {
- auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
- if(!card_ptr)
- {
- log_error("卡不存在card_id=%d", card_id);
- return;
- }
- if(card_ptr->is_person())//统计人卡
- {
- c->m_area->m_person_count--;
- //区域人卡超员
- module_area_over_person::instance()->on_leave(card_ptr, c);
- //区域人卡超时
- module_area_timeout_person::instance()->on_leave(card_ptr, c);
- }
- if(card_ptr->is_vehicle())//统计车卡
- {
- c->m_area->m_vehicle_count--;
- }
- }
- };
- #endif // MODULE_AREA_H
|