area_business_car_attendance.h 1.7 KB

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