Sfoglia il codice sorgente

Merge branch 'master' of http://local.beijingyongan.com:3000/linux-dev/ya-serv
add

lainian 6 anni fa
parent
commit
483190582b

+ 4 - 3
CMakeLists.txt

@@ -86,7 +86,7 @@ set(SRC_MODULE
 
 add_executable(${PROJECT_NAME} "main.cpp" ${SRC_YASL}  ${SRC_MODULE})
 
-target_link_libraries (${PROJECT_NAME}  zlog rt ev boost_chrono boost_system boost_thread mysqlclient)
+target_link_libraries (${PROJECT_NAME}  zlog rt ev boost_chrono boost_system boost_thread mysqlclient three_rates)
 
 #file(COPY data_reader_antenna.txt DESTINATION ${PROJECT_BINARY_DIR})
 #file(COPY path_tof.txt DESTINATION ${PROJECT_BINARY_DIR})
@@ -94,8 +94,9 @@ target_link_libraries (${PROJECT_NAME}  zlog rt ev boost_chrono boost_system boo
 #file(COPY /root/projection/out/bin/logger DESTINATION ${PROJECT_BINARY_DIR})
 #file(COPY /root/projection/out/etc DESTINATION ${PROJECT_SOURCE_DIR})
 #file(COPY /root/projection/out/log DESTINATION ${PROJECT_SOURCE_DIR})
-#file(COPY /root/projection/out/include/log.h DESTINATION ${PROJECT_SOURCE_DIR})
-#file(COPY /root/projection/out/include/config_file.h DESTINATION ${PROJECT_SOURCE_DIR})
+#file(COPY /root/projection/out/include/ DESTINATION ${PROJECT_SOURCE_DIR})
+
+
 
 
 

+ 2 - 1
cardMgr.cpp

@@ -1,6 +1,7 @@
 #include "cardMgr.h" 
 #include "bindmorecard.h"
 #include "common.h"
+#include"common_tool.h"
 
 cardMgr::cardMgr()
 :m_queue(2048)
@@ -46,7 +47,7 @@ void cardMgr::clear(uint64_t cardid)
 void cardMgr::handleMessage(const Msg &m)
 {
 	m_glist.update(m.x,m.y,m.cardid);
-	if(m.type==CT_VEHICLE) return;
+    if(tool_other::is_vehicle( m.type) ) return;
 	std::vector<uint64_t> rc=m_glist.find_near(m.cardid,1);
 	
 	log_info("LemonHash+..%d,size:%d,(%d,%d)",m.cardid,rc.size(),m.x,m.y);

+ 4 - 0
common.h

@@ -55,6 +55,10 @@ enum CARD_TYPE
 	CT_PERSON=1,
 	///卡类型 车卡
 	CT_VEHICLE=2,
+    ///    4 采煤机
+    CT_COAL_CUTTER=4,
+    ///    5  掘进机
+    CT_HEADING_MACHINE=5
 };
 
 enum AREA_TYPE

+ 10 - 0
common_tool.h

@@ -174,6 +174,16 @@ public:
         return std::stoi(to13str(str).substr(0, 3));
     }
 
+    static bool is_person(int32_t type)
+    {
+        return CT_PERSON == type;
+    }
+
+    static bool is_vehicle(int32_t type)
+    {
+        return CT_VEHICLE == type || CT_COAL_CUTTER == type || CT_HEADING_MACHINE == type;
+    }
+
 //    static uint32_t id64_to_id(uint64_t card_id)
 //    {
 //        return static_cast<uint32_t>(card_id);

+ 15 - 12
module_service/module_meta_date_changed.cpp

@@ -4,43 +4,46 @@
 #include"ant.h"
 
 
-void module_meta_date_changed::deal_call_edit_vehicle(int id, EDIT_TYPE_ID edit_type_id)
+void module_meta_date_changed::deal_call_edit_vehicle(int64_t id64, EDIT_TYPE_ID edit_type_id)
 {
     if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
     {
-        card_list::instance()->init_vehicle(id);
+        card_list::instance()->init_vehicle(id64);
     }
     else if(ET_DELETE == edit_type_id)
     {
-        remove_card(static_cast<uint32_t>(id), CT_VEHICLE);
+        auto str = tool_other::to13str(id64);
+
+        remove_card(tool_other::id64_to_id(str), tool_other::id64_to_type(str));
     }
 }
 
-void module_meta_date_changed::deal_call_edit_staff(int id, EDIT_TYPE_ID edit_type_id)
+void module_meta_date_changed::deal_call_edit_staff(int64_t id64, EDIT_TYPE_ID edit_type_id)
 {
     if(ET_INSERT == edit_type_id || ET_UPDATE == edit_type_id)
     {
-        card_list::instance()->init_staffer(id);
+        card_list::instance()->init_staffer(id64);
     }
     else if(ET_DELETE == edit_type_id)
     {
-        remove_card(static_cast<uint32_t>(id), CT_PERSON);
+        auto str = tool_other::to13str(id64);
+
+        remove_card(tool_other::id64_to_id(str), tool_other::id64_to_type(str));
     }
 }
 
-void module_meta_date_changed::deal_call_edit_card(int id64, EDIT_TYPE_ID edit_type_id)
+void module_meta_date_changed::deal_call_edit_card(int64_t id64, EDIT_TYPE_ID edit_type_id)
 {
     std::string card_id64_str = tool_other::to13str(static_cast<uint64_t>(id64));
     int type = tool_other::id64_to_type(card_id64_str);
-    int id = static_cast<int32_t>(tool_other::id64_to_id(card_id64_str));
 
-    if(CT_PERSON==type)
+    if(tool_other::is_person(type))
     {
-        deal_call_edit_staff(id, edit_type_id);
+        deal_call_edit_staff(id64, edit_type_id);
     }
-    else if(CT_VEHICLE==type)
+    else if(tool_other::is_vehicle(type))
     {
-        deal_call_edit_vehicle(id, edit_type_id);
+        deal_call_edit_vehicle(id64, edit_type_id);
     }
     else
     {

+ 6 - 4
module_service/module_meta_date_changed.h

@@ -44,7 +44,7 @@ public:
 
         std_debug("基础数据 receive meta_data_changed: %s", name.c_str());
 
-        int id=-1;
+        int64_t id=-1;
         tool_map::try_get_value(id, JSON_KEY_ID, data);
 
         std::string op_type="";
@@ -148,12 +148,14 @@ public:
     }
 
 private:
-    void deal_call_edit_vehicle(int id, EDIT_TYPE_ID edit_type_id);
+    ///id64格式为:10000001016
+    void deal_call_edit_vehicle(int64_t id64, EDIT_TYPE_ID edit_type_id);
 
-    void deal_call_edit_staff(int id, EDIT_TYPE_ID edit_type_id);
+    ///id64格式为:10000001016
+    void deal_call_edit_staff(int64_t id64, EDIT_TYPE_ID edit_type_id);
 
     ///id64格式为10000006666
-    void deal_call_edit_card(int id64, EDIT_TYPE_ID edit_type_id);
+    void deal_call_edit_card(int64_t id64, EDIT_TYPE_ID edit_type_id);
 
     void deal_call_edit_reader(int id, EDIT_TYPE_ID edit_type_id);