123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef MODULE_ATTENDANCE_PERSON_H
- #define MODULE_ATTENDANCE_PERSON_H
- #include <memory>
- #include <mutex>
- #include <map>
- #include <string>
- #include <chrono>
- #include <vector>
- #include<card.h>
- #include"ant.h"
- #include"area.h"
- #include"site_area.h"
- #include"module_const.h"
- class module_attendance_person:public singleton_base<module_attendance_person>
- {
- private:
- friend class singleton_base<module_attendance_person>;
- module_attendance_person()
- {
- }
- public:
-
- void enter_site(uint64_t card_id,int enter_site,uint64_t type,
- const std::shared_ptr<area_hover> area_hover_ptr)
- {
- auto card_ptr=card_list::instance()->get(tool_other::to_uint64_cardid(type, card_id));
- if(!card_ptr)
- {
- log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
- return;
- }
- auto site_ptr=sit_list::instance()->get(enter_site);
- if(!site_ptr)
- {
- log_error("在分站列表中找不到分站,分站id=%d", enter_site);
- return;
- }
-
- if(tool_other::is_up_site(site_ptr->m_reader_type_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, area_hover_ptr);
- log_debug("人卡考勤结束:site_id=%d,reader_type_id=%d,stat_attendance=%d",
- site_ptr->m_id,site_ptr->m_reader_type_id,card_ptr->m_stat_attendance);
- }
- }
-
- if(!tool_other::is_up_site(site_ptr->m_reader_type_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, area_hover_ptr);
- log_debug("人卡考勤开始:site_id=%d,reader_type_id=%d,stat_attendance=%d",
- site_ptr->m_id,site_ptr->m_reader_type_id,card_ptr->m_stat_attendance);
- }
- }
- }
-
- void leave_site(uint64_t card_id,int enter_site,uint64_t type,
- const std::shared_ptr<area_hover> area_hover_ptr)
- {
- }
-
- void up_well(std::vector<std::string>& card_ids)
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- };
- #endif
|