GB28181集成完成。录像bug暂未解决,已注释
| | |
| | | ../LocalDBTool/SqliteFaceEncap.cpp |
| | | ../../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.cpp |
| | | ../../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.h |
| | | ) |
| | | vss/dao/BaseDao.cpp) |
| | | |
| | | target_link_libraries(DataWebServer |
| | | glog |
New file |
| | |
| | | #include "BaseDao.h" |
| | | mysqlpp::Connection* BaseDao::conn = nullptr; |
| | | QMutex BaseDao::m_mutexVisit; |
| | |
| | | #include <iostream> |
| | | #include <mysql++.h> |
| | | #include <AppConfig.h> |
| | | #include <QtCore/QMutex> |
| | | |
| | | using namespace std; |
| | | |
| | | static mysqlpp::Connection *conn; |
| | | |
| | | class BaseDao { |
| | | public: |
| | | static QMutex m_mutexVisit; |
| | | private: |
| | | static mysqlpp::Connection* conn; |
| | | public: |
| | | static mysqlpp::SimpleResult add(std::map<std::string, std::string> &columns, string tableName) { |
| | | initConnection(); |
| | |
| | | } |
| | | return simpleResult; |
| | | } |
| | | |
| | | static bool del(string tableName, std::map<std::string, std::string> &whereColumns) { |
| | | initConnection(); |
| | | string sql = "DELETE FROM " + tableName + " where 1=1 " + getWhereColumnNameValuePair(whereColumns); |
| | |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | static bool update(std::map<std::string, std::string> &columns, string tableName, |
| | | std::map<std::string, std::string> &whereColumns) { |
| | | static bool update(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) { |
| | | string updateSql = getUpdateSql(columns, tableName, whereColumns); |
| | | initConnection(); |
| | | mysqlpp::Query query = conn->query(updateSql); |
| | |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | static string getInsertSql(std::map<std::string, std::string> &columns, string tableName) { |
| | | string insertSql = "INSERT INTO " + tableName + " (" |
| | | + getColumnNames(columns) + |
| | |
| | | cout << "insertSql " << insertSql << endl; |
| | | return insertSql; |
| | | } |
| | | |
| | | static string getUpdateSql(std::map<std::string, std::string> &columns, string tableName, |
| | | std::map<std::string, std::string> &whereColumns) { |
| | | static string getUpdateSql(std::map<std::string, std::string>& columns, string tableName, std::map<std::string, std::string>& whereColumns) { |
| | | string updateSql = "update " + tableName + " set " |
| | | + getColumnNameValuePair(columns) + |
| | | " where 1=1 " + |
| | | getWhereColumnNameValuePair(whereColumns); |
| | | getWhereColumnNameValuePair(whereColumns) |
| | | ; |
| | | cout << "updateSql " << updateSql << endl; |
| | | return updateSql; |
| | | } |
| | | |
| | | static void doConnect() { |
| | | if (conn->connect( |
| | | appConfig.getStringProperty("database").c_str(), |
| | |
| | | cout << "connect failed" << endl; |
| | | } |
| | | } |
| | | |
| | | static void initConnection() { |
| | | static bool inited = false; |
| | | if (!inited) { |
| | |
| | | doConnect(); |
| | | } |
| | | } |
| | | |
| | | static string getColumnNames(std::map<std::string, std::string> &columns) { |
| | | string columnNames; |
| | | auto size = columns.size(); |
| | |
| | | } |
| | | return columnNames; |
| | | } |
| | | |
| | | static string getColumnValues(std::map<std::string, std::string> &columns) { |
| | | string columnValues; |
| | | auto size = columns.size(); |
| | |
| | | } |
| | | return columnValues; |
| | | } |
| | | |
| | | static string getColumnNameValuePair(std::map<std::string, std::string> &columns) { |
| | | string columnNameValuePair; |
| | | auto size = columns.size(); |
| | |
| | | } |
| | | return columnNameValuePair; |
| | | } |
| | | |
| | | static string getWhereColumnNameValuePair(std::map<std::string, std::string> &columns) { |
| | | string columnNameValuePair; |
| | | auto size = columns.size(); |
New file |
| | |
| | | #include "BaseSqliteDao.h" |
| | | |
| | | LDBTool* BaseSqliteDao::lDBTool = nullptr; |
| | | QSqlDatabase* BaseSqliteDao::m_db = nullptr; |
| | | QSqlTableModel *BaseSqliteDao::m_pModel = nullptr; |
| | | QMutex* BaseSqliteDao::m_mutexVisit = nullptr; |
| | | ErlangTool::ErlangDbTool *BaseSqliteDao::erlangDbTool = nullptr; |
| | |
| | |
|
| | | /** 添加创建二级设备表 keyValuesToAdd 需要添加的列名和列值对map*/
|
| | | mysqlpp::SimpleResult addVssChannelTbl(std::map<std::string, std::string>& keyValuesToAdd) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return add(keyValuesToAdd, VSSChannelTbl_TABLE_NAME);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 删除创建二级设备表 whereColumnNameValues 列名和列值对条件 */
|
| | | bool deleteVssChannelTbl(std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return del(VSSChannelTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | | /** 更新创建二级设备表 keyValuesToUpdate 需要更新的列名和列值对; whereKeyValues 列名和列值条件 */
|
| | | bool updateVssChannelTbl(std::map<std::string, std::string>& keyValuesToUpdate,
|
| | | std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return update(keyValuesToUpdate, VSSChannelTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 查询创建二级设备表列表 querySql 要查询的sql语句 */
|
| | | vector<VssChannelTbl> findVssChannelTblList(string querySql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | vector<VssChannelTbl> vssChannelTblVec;
|
| | | vector<map<string, string>> rowDatList = findList(querySql);
|
| | | vssChannelTblVec.reserve(rowDatList.size());
|
| | |
| | |
|
| | | /** 执行sql语句 */
|
| | | bool execute(string sql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return exec(move(sql));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 添加创建一级设备表 keyValuesToAdd 需要添加的列名和列值对map*/
|
| | | mysqlpp::SimpleResult addVssDevTbl(std::map<std::string, std::string>& keyValuesToAdd) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return add(keyValuesToAdd, VSSDevTbl_TABLE_NAME);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 删除创建一级设备表 whereColumnNameValues 列名和列值对条件 */
|
| | | bool deleteVssDevTbl(std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return del(VSSDevTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | | /** 更新创建一级设备表 keyValuesToUpdate 需要更新的列名和列值对; whereKeyValues 列名和列值条件 */
|
| | | bool updateVssDevTbl(std::map<std::string, std::string>& keyValuesToUpdate,
|
| | | std::map<std::string, std::string>& whereKeyValues) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return update(keyValuesToUpdate, VSSDevTbl_TABLE_NAME, whereKeyValues);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | /** 查询创建一级设备表列表 querySql 要查询的sql语句 */
|
| | | vector<VssDevTbl> findVssDevTblList(string querySql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | vector<VssDevTbl> vssDevTblVec;
|
| | | vector<map<string, string>> rowDatList = findList(querySql);
|
| | | vssDevTblVec.reserve(rowDatList.size());
|
| | |
| | |
|
| | | /** 查询map列表 querySql 要查询的sql语句 */
|
| | | vector<map<string, string>> findMapList(string querySql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return findList(querySql);
|
| | | }
|
| | |
|
| | | /** 执行sql语句 */
|
| | | bool execute(string sql) {
|
| | | QMutexLocker mutexLocker(&m_mutexVisit);
|
| | | return exec(move(sql));
|
| | | }
|
| | |
|
| | |
| | | #include <uuid/uuid.h> |
| | | #include <jsoncpp/json/json.h> |
| | | |
| | | #define ALARM_PERCENT (10) //10% |
| | | #define ALARM_PERCENT (25) //25% |
| | | PerimeterElement::PerimeterElement(const SdkRule &rule) : |
| | | m_sdkRule(rule), |
| | | PipeElement(true), |
| | |
| | | // faceSearchRpcClient("faceCmServer", "", 10004, "tcp") |
| | | |
| | | //loopRecord server |
| | | appPref.setStringData("loopRecord.proxy", "LoopRecordVideoServer"); |
| | | //#todo |
| | | appPref.setStringData("loopRecord.ip", ""); |
| | | appPref.setIntData("loopRecord.port", 10010); |
| | | // appPref.setStringData("loopRecord.proxy", "LoopRecordVideoServer"); |
| | | // //#todo |
| | | // appPref.setStringData("loopRecord.ip", ""); |
| | | // appPref.setIntData("loopRecord.port", 10010); |
| | | //rpcClient(appPref.getStringData("loopRecord.proxy"), appPref.getStringData("loopRecord.ip"), appPref.getLongData("loopRecord.port"),"tcp"), |
| | | |
| | | LDBTool _dbTool; |
| | |
| | | appPref.setIntData("yolo.port", 10003); |
| | | // rpcClient(appPref.getStringData("yolo.proxy"), appPref.getStringData("yolo.ip"), appPref.getLongData("yolo.port"),"tcp"), |
| | | |
| | | Controllor *_Controllor = new Controllor(1, "/home/bsk/210235C23NF187000045$2019-02-28-23-07-30_209850_210049.mp4"); |
| | | Controllor *_Controllor = new Controllor(1, |
| | | "/home/pans/work/qiaojia/cut/44120000001325000005/201903/06/2019030617/44120000001325000005$2019-03-06-17-51-53_4747_4946.mp4"); |
| | | _Controllor->start(); |
| | | |
| | | getchar(); |
| | | |
| | | |
| | | |
| | | |
| | | YoloRpcElement m_YoloRpcElement("YoloRpc"); |
| | |
| | | } |
| | | if (str_tableUuid.size() > 0) { |
| | | QString sql = QString::fromStdString( |
| | | "Select a.uuid as id ,a.faceUrl as img,a.feature,b.idCard as idcard,b.enable,b.monitorLevel from '" + |
| | | "Select a.uuid as id ,a.faceUrl as img,a.feature,b.idCard as idcard,b.enabled,b.monitorLevel from '" + |
| | | str_tableUuid + |
| | | "_fea' as a ,'" + str_tableUuid + "' as b where a.uuid = b.uuid and ( a.del_flag=0 AND b.del_flag=0);"); |
| | | QSqlQuery query(g_syncDbFile); |