소스 검색

1、修改 离开区域时不更新时间和位置的bug
2、修改 人员车辆考勤表插入对象id为cardid的bug

zzj 6 년 전
부모
커밋
32d19320aa
2개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 1
      db/db_tool.cpp
  2. 6 6
      module_service/area_business_card_enter_or_leave.cpp

+ 1 - 1
db/db_tool.cpp

@@ -61,7 +61,7 @@ namespace db_tool
 
         sprintf(sql, "CALL %s(%s, %d, '%s', '%s', %d, %d, %.3f);", call.c_str(),
                type_id_to_str(card_ptr->m_type,card_ptr->m_id).c_str(),
-                card_ptr->m_id, start_str.c_str(), end_str.c_str(),
+                card_ptr->m_cid, start_str.c_str(), end_str.c_str(),
                 landmarkid, landmarkdirect, landmarkdist);
 
         log_info("attendance():%s",sql);

+ 6 - 6
module_service/area_business_card_enter_or_leave.cpp

@@ -18,11 +18,11 @@ void area_business_card_enter_or_leave::on_enter(const std::shared_ptr<area_hove
                                                  const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data>&ptr)
 {
     char sql[LENGTH_SQL]{0};
-    std::string start_time = tool_time::to_str_ex(a->m_enter_time);
+    std::string start_time = tool_time::to_str(a->m_enter_time/1000);
 //    std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
     const auto &p=a->m_enter_point;
     snprintf(sql,LENGTH_SQL,"INSERT INTO his_location_area (obj_id,card_type_id,ident,area_id,map_id,enter_time,start_point) \
-	                         VALUES ('%lld','%d','%lld',%d,%d,'%s','%.2f,%.2f');",
+	                         VALUES ('%d','%d','%d',%d,%d,'%s','%.2f,%.2f');",
 				c->m_cid,c->m_type,c->m_id, a->id(),a->mapid(),start_time.c_str(),p.x,p.y);
 
     db_tool::PushAsync(sql);
@@ -38,12 +38,12 @@ void area_business_card_enter_or_leave::on_leave(const std::shared_ptr<area_hove
                                                  const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
 {
     char sql[LENGTH_SQL]{0};
-    std::string start_time = tool_time::to_str_ex(a->m_enter_time);
-    std::string end_time = tool_time::to_str_ex(a->m_last_time);
-    std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
+    std::string start_time = tool_time::to_str(a->m_enter_time/1000);
+    std::string end_time = tool_time::to_str(a->m_last_time/1000);
+//    std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
     const auto &ep=a->m_last_point;
     snprintf(sql,LENGTH_SQL,"UPDATE his_location_area SET leave_time='%s',end_point='%.2f,%.2f' \
-	                         WHERE  enter_time='%s' AND obj_id=%d AND AND area_id=%d;",
+	                         WHERE  enter_time='%s' AND obj_id=%d AND area_id=%d;",
                 end_time.c_str(),ep.x,ep.y,
 				start_time.c_str(),c->m_cid,a->id());