area_business_car_attendance.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef AREA_BUSINESS_CAR_ATTENDANCE_H
  2. #define AREA_BUSINESS_CAR_ATTENDANCE_H
  3. #include"area_business.h"
  4. #include"unordered_map"
  5. class area_business_car_attendance:public area_business
  6. {
  7. public:
  8. area_business_car_attendance();
  9. virtual int area_business_type()
  10. {
  11. return 6;
  12. }
  13. void on_load_his(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
  14. //记录进入时间等信息,结束考勤,根据离开的时间和距离,判断是否记录一条新的考勤记录
  15. void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
  16. void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  17. //记录离开考勤区域信息,开始考勤
  18. void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  19. //static void save_attendance(const std::shared_ptr<card_location_base>& card_ptr, const std::shared_ptr<area_hover> area_hover_ptr){}
  20. static void init_attendance_area_from_db();
  21. private:
  22. static bool is_attendance_area(int area_id, int vehicle_type_id)
  23. {
  24. return m_map.end() != m_map.find(to_list_id(area_id, vehicle_type_id));
  25. }
  26. static uint64_t to_list_id(int area_id, int vehicle_type_id)
  27. {
  28. return (static_cast<uint64_t>(area_id)<<32) | static_cast<uint64_t>(vehicle_type_id);
  29. }
  30. ///area_id<<32| vehicle_type_id; att_rule_id
  31. static std::unordered_map<uint64_t, int> m_map;
  32. };
  33. #endif // AREA_BUSINESS_CAR_ATTENDANCE_H