Browse Source

CMakeLists

daiyueteng 6 years ago
parent
commit
ebfa1eef81
1 changed files with 31 additions and 2 deletions
  1. 31 2
      module_service/module_const.h

+ 31 - 2
module_service/module_const.h

@@ -317,6 +317,34 @@ public:
         return (type<<32)|id; ////// (类型<<32)|卡号
     }
 
+    static std::string to_uint64_cardid_str(uint64_t type, uint64_t id)
+    {
+        char sql[15] = {'\0'};
+        sprintf(sql, "%03d%010d", type, id);
+
+        return std::string(sql);
+    }
+
+    static bool is_attendance_area(int area_id, uint64_t vehicle_id)
+    {
+        char sql[1024] = {'\0'};
+
+        sprintf(sql,
+                "select vt.att_rule_id  from dat_att_rule_area a, dat_att_rule_vehicle_type  vt, dat_vehicle v\
+                where a.area_id=%d and v.vehicle_id=%d \
+                and vt.vehicle_type_id=v.vehicle_type_id \
+                and a.att_rule_id=vt.att_rule_id;",
+                area_id, vehicle_id);
+        std::string Error;
+        YADB::CDBResultSet DBRes;
+        sDBConnPool.Query(sql,DBRes,Error);
+        int nCount = DBRes.GetRecordCount( Error );
+
+        log_debug("车卡考勤区域查询:nCount=%d,sql=%s", nCount, sql);
+
+        return  (nCount > 0);
+    }
+
     static uint64_t to_event_list_id(int obj_id, EVENT_TYPE ev_type)
     {
         return (static_cast<uint64_t>(ev_type)<<32)|static_cast<uint64_t>(obj_id);
@@ -436,8 +464,9 @@ public:
             landmarkdist = area_hover_ptr->landmark_dis;
         }
 
-        sprintf(sql, "CALL %s(%d, %d, '%s', '%s', %d, %d, %.3f);", call.c_str(),
-                card_ptr->m_id, card_ptr->m_type, start_str.c_str(), end_str.c_str(),
+        sprintf(sql, "CALL %s(%s, %d, '%s', '%s', %d, %d, %.3f);", call.c_str(),
+                tool_other::to_uint64_cardid_str(card_ptr->m_type, card_ptr->m_id).c_str(),
+                card_ptr->m_id, start_str.c_str(), end_str.c_str(),
                 landmarkid, landmarkdirect, landmarkdist);
 
         PushAsync(sql);