Browse Source

虹膜考勤中-新增部门,和井上分站第一次接收的时间

chensongchao 5 years ago
parent
commit
51e6876e1b
2 changed files with 40 additions and 4 deletions
  1. 31 3
      card_person.cpp
  2. 9 1
      card_person.h

+ 31 - 3
card_person.cpp

@@ -67,7 +67,6 @@ void person::clear()
     	m.cmd=CMD_CLEAR;m.cardid=m_type<<32|m_id;
     	cardMgr::instance()->tryPut(m);
     }
-
 }
 
 void person::set_area_info(int mapid,double scale,int areaid,uint64_t t,int type)
@@ -95,10 +94,23 @@ void person::IKSDK_DB(int sid)
 		}
 		std::string card_id = tool_other::type_id_to_str(m_type,m_id);
 		std::string st	    = tool_time::to_str(now);
+		if (m_frist_iris_recognition_timeval == "")
+		{
+			m_frist_iris_recognition_timeval = st;
+		}
+
 		char nsql[256]={0};
-		const char*sql="REPLACE INTO his_att_interface (staff_id,card_id,reader_id,staff_name,dept_name,upt_time,low_power_warn) VALUES (%d,%s,%d,'%s','%s','%s',%d);";
-		snprintf(nsql,256,sql,m_cid,card_id.c_str(),sid,m_stafferName.c_str(),m_deptName.c_str(),st.c_str(),f);
+		const char*sql="REPLACE INTO his_att_interface (staff_id,card_id,reader_id,staff_name,dept_id,dept_name,upt_time,low_power_warn,frist_write_time)"
+				 " VALUES (%d,%s,%d,'%s',%d,'%s','%s',%d,'%s');";
+		snprintf(nsql,256,sql,m_cid,card_id.c_str(),sid,m_stafferName.c_str(),m_deptid,m_deptName.c_str(),st.c_str(),f,m_frist_iris_recognition_timeval.c_str());
+
 		db_tool::PushAsync(nsql);
+
+		m_old_iris_recognition_timeval = m_iris_recognition_timeval;
+		if(m_old_iris_recognition_timeval == 0)
+		{
+			m_old_iris_recognition_timeval = now;
+		}
 		m_iris_recognition_timeval = now;
 	}
 }
@@ -146,6 +158,9 @@ void person::on_timer()
         return ;
     }
     m_1sto2s=false;
+
+    check_frist_iris_recognition_time();
+
     if(!m_mine_tool->m_is_attendance)
 	{
 		if(m_upmine_flag.load())
@@ -156,6 +171,8 @@ void person::on_timer()
 
 		return;
 	}
+    m_frist_iris_recognition_timeval = "";
+
 	YA::_CARD_POS_ cp;
 	uint64_t _time=0;
 	point pt = getSmoothPoint(_time);
@@ -245,3 +262,14 @@ void person::get_card(bool f)
 	mine_business::inst()->fetch_add(m_display);
 }
 
+void person::check_frist_iris_recognition_time()
+{
+	if (m_frist_iris_recognition_timeval.length() < 4)
+	{
+		return ;
+	}
+	if (time(nullptr) - m_iris_recognition_timeval > 10)
+    {
+		m_frist_iris_recognition_timeval = "";
+    }
+}

+ 9 - 1
card_person.h

@@ -9,7 +9,7 @@ struct person:card_location_base, card_area
     int m_workLine=0;	
 	int m_worktype_id=0;
     int m_thour{-1};
-    time_t m_iris_recognition_timeval = 0;
+
     static int m_limit_detained_time;
     static int m_auto_up_mine_time;
     static int m_person_cards_flag;
@@ -41,6 +41,14 @@ struct person:card_location_base, card_area
     {
         return m_workLine;
     }
+
+public:
+    //虹膜考勤相关
+    //记录最早井上分站接收的状态
+    time_t m_iris_recognition_timeval = 0;
+    time_t m_old_iris_recognition_timeval = 0;
+    std::string m_frist_iris_recognition_timeval = "";
+    void check_frist_iris_recognition_time();
 };
 #endif