area_business_car_attendance.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. 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);
  10. //记录进入时间等信息,结束考勤,根据离开的时间和距离,判断是否记录一条新的考勤记录
  11. void on_enter(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr);
  12. void on_hover(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  13. //记录离开考勤区域信息,开始考勤
  14. void on_leave(const std::shared_ptr<area_hover>&a,const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr);
  15. //static void save_attendance(const std::shared_ptr<card_location_base>& card_ptr, const std::shared_ptr<area_hover> area_hover_ptr){}
  16. static void init_attendance_area_from_db();
  17. private:
  18. static bool is_attendance_area(int area_id, int vehicle_type_id)
  19. {
  20. return m_map.end() != m_map.find(to_list_id(area_id, vehicle_type_id));
  21. }
  22. static uint64_t to_list_id(int area_id, int vehicle_type_id)
  23. {
  24. return (static_cast<uint64_t>(area_id)<<32) | static_cast<uint64_t>(vehicle_type_id);
  25. }
  26. ///area_id<<32| vehicle_type_id; att_rule_id
  27. static std::unordered_map<uint64_t, int> m_map;
  28. };
  29. #endif // AREA_BUSINESS_CAR_ATTENDANCE_H