|
@@ -23,7 +23,6 @@
|
|
|
#include "visit.h"
|
|
|
#include "his_location.h"
|
|
|
#include "three_rates.h"
|
|
|
-
|
|
|
extern config_file config;
|
|
|
//一张卡一个ct的所有不同天线的信息
|
|
|
struct one_ct_message_handle
|
|
@@ -123,6 +122,7 @@ struct one_ct_message_handle
|
|
|
|
|
|
void calc_location()
|
|
|
{
|
|
|
+ log_info("calc_location:%d begin",m_card->m_id);
|
|
|
auto v = m_msg_list;
|
|
|
|
|
|
std::vector<point> rc=std::move(m_loc_tool.calc_location(v));
|
|
@@ -130,6 +130,7 @@ struct one_ct_message_handle
|
|
|
if(!rc.empty()) m_card->on_location(std::move(rc),v);
|
|
|
|
|
|
reset();
|
|
|
+ log_info("calc_location:%d end",m_card->m_id);
|
|
|
}
|
|
|
};
|
|
|
struct card_message_handle
|
|
@@ -219,7 +220,7 @@ struct person:card_location_base, card_area
|
|
|
|
|
|
void clear()
|
|
|
{
|
|
|
- m_site_area.reset(new site_area_hover);
|
|
|
+ //m_site_area.reset(new site_area_hover);
|
|
|
m_area_tool.reset(new area_tool);
|
|
|
m_mine_tool.reset(new mine_tool);
|
|
|
|
|
@@ -367,7 +368,7 @@ struct car:card_location_base,card_area
|
|
|
m_area_tool->on_point(m_id,pt,m_speed,m_type);
|
|
|
m_site_area->on_point(m_id,0,this, m_type);
|
|
|
m_mine_tool->on_point(m_id, m_type, m_vehicle_category_id);
|
|
|
- handle_three_rates(pt);
|
|
|
+ handle_three_rates(pt);
|
|
|
}
|
|
|
|
|
|
int get_vehicle_type_id()
|
|
@@ -456,7 +457,7 @@ uint64_t card_list::getId(uint32_t cardid,uint64_t type)
|
|
|
return type<<32|cardid;
|
|
|
}
|
|
|
|
|
|
-void card_list::init_staffer(int32_t id)
|
|
|
+void card_list::init_staffer(int64_t id64)
|
|
|
{
|
|
|
std::string strategy = config.get("person.strategy","person1");
|
|
|
std::string sql = "SELECT staff_id, s.card_id, c.card_type_id, s.dept_id, s.group_id, s.occupation_id, \
|
|
@@ -465,11 +466,10 @@ void card_list::init_staffer(int32_t id)
|
|
|
LEFT JOIN dat_card c ON s.card_id = c.card_id \
|
|
|
LEFT JOIN dat_occupation o ON s.occupation_id = o.occupation_id \
|
|
|
LEFT JOIN dat_occupation_level ol ON ol.occupation_level_id = o.occupation_level_id \
|
|
|
- WHERE c.card_type_id = 1 AND s.duty_id = 0 AND c.state_id = 0";
|
|
|
+ WHERE s.duty_id = 0 AND c.state_id = 0";
|
|
|
|
|
|
- int type = CT_PERSON;
|
|
|
- std::string card_id_str = card_list::to_id64_str(type, static_cast<uint32_t>(id));
|
|
|
- if(-1 == id)
|
|
|
+ std::string card_id_str = tool_other::to13str(id64);
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
sql.append(";");
|
|
|
}
|
|
@@ -527,18 +527,18 @@ void card_list::init_staffer(int32_t id)
|
|
|
//for now;
|
|
|
//staff_id = vsid;
|
|
|
|
|
|
- if(-1 == id)
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
std::shared_ptr<card_location_base> clb =
|
|
|
std::make_shared<person>(strategy,vsid,need_display,card_type_id,dept_id,occupation_level_id,staff_id,work_line);
|
|
|
- uint64_t cardid = getId(vsid,type);
|
|
|
+ uint64_t cardid = getId(vsid,card_type_id);
|
|
|
log_info("cardId:%llu,id:%d dept_id:%d,need_display:%d,card:%s:work_line:%d,staff_id:%d,type:%d",
|
|
|
cardid,vsid,dept_id,need_display,card_id.c_str(),work_line,staff_id,card_type_id);
|
|
|
map.insert({cardid,clb});
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- auto card_id64 = card_list::to_id64(type, static_cast<uint32_t>(id));
|
|
|
+ auto card_id64 = card_list::to_id64(card_type_id, tool_other::id64_to_id(card_id));
|
|
|
auto card_ptr = card_list::instance()->get(card_id64);
|
|
|
if(card_ptr)
|
|
|
{
|
|
@@ -556,21 +556,21 @@ void card_list::init_staffer(int32_t id)
|
|
|
card_list::instance()->add(card_id64, clb);
|
|
|
}
|
|
|
|
|
|
- log_info("基础数据 增加或修改人卡成功:卡id:%d,卡type:%d dept_id:%d,need_display:%d,occupation_level_id:%d",
|
|
|
- id,type,dept_id,need_display,occupation_level_id);
|
|
|
- std_debug("基础数据 增加或修改人卡成功:卡id:%d,卡type:%d dept_id:%d,need_display:%d,occupation_level_id:%d",
|
|
|
- id,type,dept_id,need_display,occupation_level_id);
|
|
|
+ log_info("基础数据 增加或修改人卡成功:卡id:%ld, dept_id:%d,need_display:%d,occupation_level_id:%d",
|
|
|
+ id64,dept_id,need_display,occupation_level_id);
|
|
|
+ std_debug("基础数据 增加或修改人卡成功:卡id:%ld, dept_id:%d,need_display:%d,occupation_level_id:%d",
|
|
|
+ id64,dept_id,need_display,occupation_level_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(-1 == id)
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
log_info( "init_staffer. The record count=%d\n", nCount );
|
|
|
card_list::instance()->add(map);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void card_list::init_vehicle(int32_t id)
|
|
|
+void card_list::init_vehicle(int64_t id64)
|
|
|
{
|
|
|
std::string strategy = config.get("car.strategy","car1");
|
|
|
std::string sql = "SELECT ve.vehicle_id, ve.card_id, c.card_type_id, \
|
|
@@ -584,11 +584,10 @@ void card_list::init_vehicle(int32_t id)
|
|
|
LEFT JOIN dat_group g ON ve.group_id = g.group_id \
|
|
|
LEFT JOIN dat_vehicle_type vt ON v.vehicle_type_id = vt.vehicle_type_id \
|
|
|
LEFT JOIN dat_vehicle_category vc ON vc.vehicle_category_id = vt.vehicle_category_id \
|
|
|
- WHERE c.card_type_id = 2 AND c.state_id = 0";
|
|
|
+ WHERE c.state_id = 0";
|
|
|
|
|
|
- int type = CT_VEHICLE;
|
|
|
- std::string card_id_str = card_list::to_id64_str(type, static_cast<uint32_t>(id));
|
|
|
- if(-1 == id)
|
|
|
+ std::string card_id_str = tool_other::to13str(id64);
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
sql.append(";");
|
|
|
}
|
|
@@ -656,18 +655,18 @@ void card_list::init_vehicle(int32_t id)
|
|
|
//for now
|
|
|
//vehicle_id = vsid;
|
|
|
|
|
|
- if(-1 == id)
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
auto clb = std::make_shared<car>(strategy,vsid,need_display,card_type_id,
|
|
|
dept_id,vehicle_category_id, vehicle_type_id,vehicle_level_id,vehicle_id);
|
|
|
- uint64_t cardid = getId(vsid,type);
|
|
|
+ uint64_t cardid = getId(vsid,card_type_id);
|
|
|
log_info("cardId:%llu,id:%d dept_id:%d,need_display:%d-cardid:%s,categoryid:%d,vchile_id:%d,type:%d",
|
|
|
cardid,vsid,dept_id,need_display,card_id.c_str(),vehicle_category_id,vehicle_id,card_type_id);
|
|
|
map.insert({cardid,clb});
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- auto card_id64 = card_list::to_id64(type, static_cast<uint32_t>(id));
|
|
|
+ auto card_id64 = card_list::to_id64(card_type_id, tool_other::id64_to_id(card_id));
|
|
|
auto card_ptr = card_list::instance()->get(card_id64);
|
|
|
if(card_ptr)
|
|
|
{
|
|
@@ -685,14 +684,14 @@ void card_list::init_vehicle(int32_t id)
|
|
|
card_list::instance()->add(card_id64, clb);
|
|
|
}
|
|
|
|
|
|
- log_info("基础数据 增加或修改车卡成功:卡id:%d,卡type:%d dept_id:%d,need_display:%d,categoryid:%d",
|
|
|
- vsid,type,dept_id,need_display,vehicle_category_id);
|
|
|
- std_debug("基础数据 增加或修改车卡成功:卡id:%d,卡type:%d dept_id:%d,need_display:%d,categoryid:%d",
|
|
|
- vsid,type,dept_id,need_display,vehicle_category_id);
|
|
|
+ log_info("基础数据 增加或修改车卡成功:卡id:%ld, dept_id:%d,need_display:%d,categoryid:%d",
|
|
|
+ id64,dept_id,need_display,vehicle_category_id);
|
|
|
+ std_debug("基础数据 增加或修改车卡成功:卡id:%ld, dept_id:%d,need_display:%d,categoryid:%d",
|
|
|
+ id64,dept_id,need_display,vehicle_category_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(-1 == id)
|
|
|
+ if(-1 == id64)
|
|
|
{
|
|
|
log_info( "init_vehicle. The record count=%d\n", nCount );
|
|
|
card_list::instance()->add(map);
|
|
@@ -1173,7 +1172,7 @@ void card_location_base::on_location(const std::vector<point>&vp,const std::vect
|
|
|
|
|
|
Msg m;
|
|
|
m.type=m_type;m.x=(int)x;m.y=(int)y;m.cmd=CMD_HANDLE;m.cardid=m_type<<32|m_id;
|
|
|
- cardMgr::instance()->tryPut(m);
|
|
|
+ //cardMgr::instance()->tryPut(m);
|
|
|
double acc = lm[0].m_acc;
|
|
|
log_info("useful:card_id:%d,ct:%d,timestamp:%llu, loc_point,x:%.2f,y:%.2f acc:%.2f",m_id,m_ct,m_time,pt.x,pt.y,acc);
|
|
|
do_business(pt,acc);
|
|
@@ -1256,6 +1255,17 @@ void card_location_base::put_three_rates(card_pos & cp)
|
|
|
log_info("three_rates:type:%d,id:%d,cid:%d",cp.type,cp.id,cp.identifier_id);
|
|
|
three_rates::get_instance()->put(cp);
|
|
|
}
|
|
|
+
|
|
|
+bool card_location_base::is_person() const
|
|
|
+{
|
|
|
+ return tool_other::is_person(m_type);
|
|
|
+}
|
|
|
+
|
|
|
+bool card_location_base::is_vehicle() const
|
|
|
+{
|
|
|
+ return tool_other::is_vehicle(m_type);
|
|
|
+}
|
|
|
+
|
|
|
card_location_base::~card_location_base()
|
|
|
{
|
|
|
}
|