|
@@ -162,8 +162,7 @@ void card_list::load_his_card_postion_from_db()
|
|
|
void card_list::load_his_card_postion_vehicle()
|
|
|
{
|
|
|
const char *sql = "select l.card_id, l.cur_time, l.x, l.y, l.z, l.area_info, l.state, \
|
|
|
- case when l.cur_time >= date_sub(now(), interval 2 minute) then l.speed else 0 end as speed, \
|
|
|
- att.start_time, att.end_time\
|
|
|
+ att.start_time, att.end_time \
|
|
|
from rt_location l, rt_att_vehicle att, dat_card c, dat_vehicle_extend v \
|
|
|
where l.card_id = c.card_id and l.card_id = att.card_id and l.card_id=v.card_id \
|
|
|
and c.state_id=0;";
|
|
@@ -179,12 +178,14 @@ void card_list::load_his_card_postion_vehicle()
|
|
|
|
|
|
while ( DBRes.GetNextRecod(Error) )
|
|
|
{
|
|
|
- long long int card_id = 0;
|
|
|
+ std::string card_id = "";
|
|
|
DBRes.GetField( "card_id",card_id, Error );
|
|
|
- auto temp_ptr = card_list::instance()->get(card_id);
|
|
|
+ uint32_t id = tool_other::id64_to_id(card_id);
|
|
|
+ int type = tool_other::id64_to_type(card_id);
|
|
|
+ auto temp_ptr = card_list::instance()->get(tool_other::type_id_to_u64(type, id));
|
|
|
if(!temp_ptr || !temp_ptr->is_vehicle())
|
|
|
{
|
|
|
- log_error("全局卡列表中找不到卡,卡id=%lu", card_id);
|
|
|
+ log_error("全局卡列表中找不到卡,卡id=%d,卡type=%d", id, type);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -214,15 +215,6 @@ void card_list::load_his_card_postion_vehicle()
|
|
|
std::string end_time = "";
|
|
|
DBRes.GetField( "end_time",end_time, Error );
|
|
|
|
|
|
- int landmark_id = 0;
|
|
|
- DBRes.GetField( "landmark_id",landmark_id, Error );
|
|
|
-
|
|
|
- int direction_mapper_id = 0;
|
|
|
- DBRes.GetField( "direction_mapper_id",direction_mapper_id, Error );
|
|
|
-
|
|
|
- double landmark_dist = 0;
|
|
|
- DBRes.GetField( "landmark_dist",landmark_dist, Error );
|
|
|
-
|
|
|
card_ptr->x = x;
|
|
|
card_ptr->y = y;
|
|
|
card_ptr->z = z;
|
|
@@ -236,7 +228,7 @@ void card_list::load_his_card_postion_vehicle()
|
|
|
uint64_t enter_time = 0;
|
|
|
sscanf(p, "%d,%lu", &area_id, &enter_time);
|
|
|
p = strtok(NULL, split);
|
|
|
- if (area_id <= 0)
|
|
|
+ if (area_id < 0)
|
|
|
continue;
|
|
|
|
|
|
auto area = area_list::instance()->get(area_id);
|
|
@@ -245,8 +237,6 @@ void card_list::load_his_card_postion_vehicle()
|
|
|
log_error("load_vehicle...area_list 找不到区域:区域id=%d", area_id);
|
|
|
continue;
|
|
|
}
|
|
|
- area->m_vehicle_count++;
|
|
|
- card_ptr->m_speed = speed;
|
|
|
|
|
|
if(end_time.empty())
|
|
|
{
|
|
@@ -271,8 +261,7 @@ void card_list::load_his_card_postion_vehicle()
|
|
|
void card_list::load_his_card_postion_staff()
|
|
|
{
|
|
|
const char *sql = "select l.card_id, l.cur_time, l.x, l.y, l.z, l.area_info, l.state, \
|
|
|
- case when l.cur_time >= date_sub(now(), interval 2 minute) then l.speed else 0 end as speed, \
|
|
|
- att.start_time, att.end_time\
|
|
|
+ att.start_time, att.end_time \
|
|
|
from rt_location l, rt_att_staff att, dat_card c, dat_staff_extend s \
|
|
|
where l.card_id = c.card_id and l.card_id = att.card_id and l.card_id=s.card_id\
|
|
|
and c.state_id=0;";
|
|
@@ -295,12 +284,14 @@ void card_list::load_his_card_postion_staff()
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- long long int card_id = 0;
|
|
|
+ std::string card_id = "";
|
|
|
DBRes.GetField( "card_id",card_id, Error );
|
|
|
- auto temp_ptr = card_list::instance()->get(card_id);
|
|
|
+ uint32_t id = tool_other::id64_to_id(card_id);
|
|
|
+ int type = tool_other::id64_to_type(card_id);
|
|
|
+ auto temp_ptr = card_list::instance()->get(tool_other::type_id_to_u64(type, id));
|
|
|
if(!temp_ptr || !temp_ptr->is_person())
|
|
|
{
|
|
|
- log_error("全局卡列表中找不到卡,卡id=%lu", card_id);
|
|
|
+ log_error("全局卡列表中找不到卡,卡id=%d,卡type=%d", id, type);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -327,15 +318,6 @@ void card_list::load_his_card_postion_staff()
|
|
|
std::string start_time = "";
|
|
|
DBRes.GetField( "start_time",start_time, Error );
|
|
|
|
|
|
- int landmark_id = 0;
|
|
|
- DBRes.GetField( "landmark_id",landmark_id, Error );
|
|
|
-
|
|
|
- int direction_mapper_id = 0;
|
|
|
- DBRes.GetField( "direction_mapper_id",direction_mapper_id, Error );
|
|
|
-
|
|
|
- double landmark_dist = 0;
|
|
|
- DBRes.GetField( "landmark_dist",landmark_dist, Error );
|
|
|
-
|
|
|
card_ptr->x = x;
|
|
|
card_ptr->y = y;
|
|
|
card_ptr->z = z;
|
|
@@ -349,7 +331,7 @@ void card_list::load_his_card_postion_staff()
|
|
|
uint64_t enter_time = 0;
|
|
|
sscanf(p, "%d,%lu", &area_id, &enter_time);
|
|
|
p = strtok(NULL, split);
|
|
|
- if (area_id <= 0)
|
|
|
+ if (area_id < 0)
|
|
|
continue;
|
|
|
|
|
|
auto area = area_list::instance()->get(area_id);
|
|
@@ -358,8 +340,6 @@ void card_list::load_his_card_postion_staff()
|
|
|
log_error("area_list 找不到区域:区域id=%d", area_id);
|
|
|
continue;
|
|
|
}
|
|
|
- area->m_person_count++;
|
|
|
- card_ptr->m_speed = speed;
|
|
|
|
|
|
if(end_time.empty())
|
|
|
{
|