12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #ifndef MODULE_ATTENDANCE_VEHICLE_H
- #define MODULE_ATTENDANCE_VEHICLE_H
- #include <memory>
- #include <mutex>
- #include <map>
- #include <string>
- #include <chrono>
- #include <vector>
- #include <set>
- #include "module_const.h"
- class module_attendance_vehicle:public singleton_base<module_attendance_vehicle>
- {
- private:
- friend class singleton_base<module_attendance_vehicle>;
- module_attendance_vehicle()
- {
- }
- public:
- void on_enter(std::shared_ptr<card_location_base> card_ptr,std::shared_ptr<area_hover>&c,double speed)
- {
- auto area_ptr = c->m_area;
-
- if(!tool_other::is_attendance_area(area_ptr->m_id, card_ptr->m_id))
- {
- if(tool_other::is_attendance(card_ptr->m_stat_attendance))
- {
-
- card_ptr->m_stat_attendance=AS_NOT_ATTENDANCE;
-
- tool_db::save_attendance(card_ptr);
- log_debug("车卡考勤结束:area_id=%d,card_id=%d,stat_attendance=%d",
- area_ptr->m_id,card_ptr->m_id,card_ptr->m_stat_attendance);
- }
- }
- if(tool_other::is_attendance_area(area_ptr->m_id, card_ptr->m_id))
- {
- if(!tool_other::is_attendance(card_ptr->m_stat_attendance))
- {
-
- card_ptr->m_stat_attendance=AS_ATTENDANCE;
-
- std::time_t start= card_ptr->m_time/1000;
- card_ptr->m_attendance_start_time=std::chrono::system_clock::from_time_t(start);
-
- tool_db::save_attendance(card_ptr);
- log_debug("车卡考勤开始:area_id=%d,card_id=%d,stat_attendance=%d",
- area_ptr->m_id,card_ptr->m_id,card_ptr->m_stat_attendance);
- }
- }
- }
- void on_hover(std::shared_ptr<card_location_base> card_ptr,std::shared_ptr<area_hover>&c,double speed)
- {
- }
- void on_leave(std::shared_ptr<card_location_base> card_ptr,std::shared_ptr<area_hover>&c,double speed)
- {
- }
- };
- typedef std::shared_ptr<module_attendance_vehicle> module_attendance_vehicle_ptr;
- #endif
|